473,765 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

image uploads and version control?

I'm developing a php website that I have under subversion version
control. I'm working on an image upload functionality, and in the
middle of it I realized that any files that a user uploads will not be
under version control, and if I checkout or export the site from
version control, and deploy it, it won't bring any of the uploaded
files with it.

I'm looking at php subversion functions, but the manual says that
they're experimental, and my webhost hasn't deployed them.

What's a workaround for this? I'm thinking that I'll have to have a
parallel site for image hosting. For example, I'll have
images.website. com, hosted under a separate filesystem directory, and
then in the actual website that a user would peruse, any img src would
reference images.website. com . When I accept my uploads, I'll do my
filesystem copy to the images filesystem link.

Thoughts?
Oct 10 '08 #1
12 1802
On Fri, 10 Oct 2008 12:25:59 -0700 (PDT), la*****@gmail.c om wrote in
<36************ *************** *******@s50g200 0hsb.googlegrou ps.com>:
>I'm developing a php website that I have under subversion version
control. I'm working on an image upload functionality, and in the
middle of it I realized that any files that a user uploads will not be
under version control, and if I checkout or export the site from
version control, and deploy it, it won't bring any of the uploaded
files with it.
Why would you want it to? This is user data, not data that is
actually part of the application. In any case, why would users be
interacting with a copy of the application that is a Subversion
working copy?

I think that I must have misunderstood, because it sounds like you
want to use Subversion as a packaging and distribution mechanism, and
that's not what it's for.

[snip]
--
Charles Calvert | Web-site Design/Development
Celtic Wolf, Inc. | Software Design/Development
http://www.celticwolf.com/ | Data Conversion
(703) 580-0210 | Project Management
Oct 13 '08 #2
>I'm developing a php website that I have under subversion version
>control. I'm working on an image upload functionality, and in the
middle of it I realized that any files that a user uploads will not be
under version control, and if I checkout or export the site from
version control, and deploy it, it won't bring any of the uploaded
files with it.

Why would you want it to? This is user data, not data that is
actually part of the application.
Exactly. Subversion is there to facilitate rolling new versions out and
develop them. What you probably want is a good backup facility. The fact
that subversion never forgets anything makes it a less-than-optimal
backup system. Off course it was never *meant* as a backup system.

Best regards,
--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/
Oct 13 '08 #3
On Oct 13, 12:06*am, Charles Calvert <cb...@yahoo.co mwrote:
I think that I must have misunderstood, because it sounds like you
want to use Subversion as a packaging and distribution mechanism, and
that's not what it's for.
Well, here's the problem, as I perceive it:

Say my website is served from a directory called /home/user/website .

Users of the website need to be able to upload images, which in the
current incarnation of the website I specified to be served /home/user/
website/images. This directory currently holds all images served with
the site, not just user uploaded images.

My 'packaging and distribution' practice currently consists of 'svn
export http://svn-host/website/trunk', and then linking that to the
website directory, e.g. 'ln -s website-trunk-revision-189 /home/user/
website'.

So the problem is, unless user uploaded images were put under version
control, which I would have to do by migrating the image from the live
to the development site, and then putting it under version control,
the user uploaded images wouldn't be in an exported revision of the
website.

So my thought would be rather than try to include them in version
control, move the functionality of accepting and serving user uploaded
images from a subdirectory of the website to its own domain, and just
not keep it under version control.

So when I export the website, it won't include any uploaded files,
unless they were put under version control.

Oct 13 '08 #4
On Oct 13, 4:04*am, Willem Bogaerts <w.bogae...@kra tz.nlwrote:
>
Exactly. Subversion is there to facilitate rolling new versions out and
develop them. What you probably want is a good backup facility. The fact
that subversion never forgets anything makes it a less-than-optimal
backup system. Off course it was never *meant* as a backup system.
Well, I guess I don't know how others roll out websites from
subversion, but I'm just using 'export', and then creating a symlink
of the svn export to the webhost directory. So the problem is, if I'm
serving user-uploaded images out of a subdirectory in the website
( e.g. /user/home/website/user-uploaded-images ), unless new uploads
are put under version control, they would not exist in an export when
I roll out a new release of the website. So I guess if you want to
call that 'backup' functionality, I see that side of it, but to me, it
isn't any different than just making sure all the pieces of your
project exist when you do an export, which I think might be an
implicit functionality of version control.

When I use svn export to roll out a new version of the site, I could
copy the user uploaded images into the image directory, but that adds
an extra step to releasing a new site, and I like to keep things
simple. I have enough to worry about when I roll out a new version. So
my thought now for user uploaded images is simply not to serve them
from within the web directory, but put up a whole other host that's
not under version control, and serve them from there.

Oct 13 '08 #5
la*****@gmail.c om wrote:
On Oct 13, 4:04 am, Willem Bogaerts <w.bogae...@kra tz.nlwrote:
>Exactly. Subversion is there to facilitate rolling new versions out and
develop them. What you probably want is a good backup facility. The fact
that subversion never forgets anything makes it a less-than-optimal
backup system. Off course it was never *meant* as a backup system.

Well, I guess I don't know how others roll out websites from
subversion, but I'm just using 'export', and then creating a symlink
of the svn export to the webhost directory. So the problem is, if I'm
serving user-uploaded images out of a subdirectory in the website
( e.g. /user/home/website/user-uploaded-images ), unless new uploads
are put under version control, they would not exist in an export when
I roll out a new release of the website. So I guess if you want to
call that 'backup' functionality, I see that side of it, but to me, it
isn't any different than just making sure all the pieces of your
project exist when you do an export, which I think might be an
implicit functionality of version control.

When I use svn export to roll out a new version of the site, I could
copy the user uploaded images into the image directory, but that adds
an extra step to releasing a new site, and I like to keep things
simple. I have enough to worry about when I roll out a new version. So
my thought now for user uploaded images is simply not to serve them
from within the web directory, but put up a whole other host that's
not under version control, and serve them from there.

As others have indicated - the problem is you're using subversion for
something other than what it's intended for. What you need is a good
backup strategy, not a version control system.

But in any case, this has absolutely nothing to do with PHP, so this is
the wrong newsgroup, anyway.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Oct 13 '08 #6
On Mon, 13 Oct 2008 06:23:48 -0700 (PDT), la*****@gmail.c om wrote in
<7e************ *************** *******@v72g200 0hsv.googlegrou ps.com>:
>On Oct 13, 12:06*am, Charles Calvert <cb...@yahoo.co mwrote:
>I think that I must have misunderstood, because it sounds like you
want to use Subversion as a packaging and distribution mechanism, and
that's not what it's for.

Well, here's the problem, as I perceive it:

Say my website is served from a directory called /home/user/website .
Are you on a shared host? If not, then it should be /var/www/website
or something similar. I'll assume that you're on a shared host.
>Users of the website need to be able to upload images, which in the
current incarnation of the website I specified to be served /home/user/
website/images. This directory currently holds all images served with
the site, not just user uploaded images.

My 'packaging and distribution' practice currently consists of 'svn
export http://svn-host/website/trunk', and then linking that to the
website directory, e.g. 'ln -s website-trunk-revision-189 /home/user/
website'.
I would just get the desired revision from svn and copy the source
files to the production directory. You might need to clean out the
production directory first if you've removed any files.
>So the problem is, unless user uploaded images were put under version
control, which I would have to do by migrating the image from the live
to the development site, and then putting it under version control,
the user uploaded images wouldn't be in an exported revision of the
website.
You're making this too complex. Subversion is for controling
revisions of your source code and related files (e.g. design docs),
nothing else. Once you put the application into production and have
begun accumulating user data, just copy the source files from a
working directory to the production directory using cp -r or a shell
script.
--
Charles Calvert | Web-site Design/Development
Celtic Wolf, Inc. | Software Design/Development
http://www.celticwolf.com/ | Data Conversion
(703) 580-0210 | Project Management
Oct 13 '08 #7
On Oct 13, 10:38*am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>
As others have indicated - the problem is you're using subversion for
something other than what it's intended for. *What you need is a good
backup strategy, not a version control system.
I'm using subversion for version control. If my website has an image
that's part of the website, it goes under version control, like any
other file that's part of the website. When I say it belongs under
version control, I mean that "Version 3.x has X version of this logo,
Version 4.x has another version".

If versioning images and other binary files are not the purview of
version control, then why does subversion have functionality for
versioning binary images, such as locking, etc.?

I'm not using it for 'backup' in the sense of "Oops! I deleted this
file accidentally. I need it to get it back, so let me go into the
backup and retrieve a copy of it. What is the definition of "backup"
that you're using here?

I don't see how this is a backup issue rather than a version control
issue. I think you might argure the point that this might be a
packaging and distribution issue as Charles Calvert did earlier, but
in this case, it isn't a c++ solution that requires a build
environment -- here, "svn export" *is* the packaging and distribution.
If you're using php and svn, what extra packaging and distribution
would you need for a site that's not released to anybody else, or
installed on any other systems?
Oct 13 '08 #8
On Oct 13, 11:30*am, Charles Calvert <cb...@yahoo.co mwrote:
On Mon, 13 Oct 2008 06:23:48 -0700 (PDT), lawp...@gmail.c om wrote in
<7edb880b-1c8e-4060-b59c-e2ecd2d0d...@v7 2g2000hsv.googl egroups.com>:
On Oct 13, 12:06*am, Charles Calvert <cb...@yahoo.co mwrote:
I think that I must have misunderstood, because it sounds like you
want to use Subversion as a packaging and distribution mechanism, and
that's not what it's for.
Well, here's the problem, as I perceive it:
Say my website is served from a directory called /home/user/website .

Are you on a shared host? *If not, then it should be /var/www/website
or something similar. *I'll assume that you're on a shared host.
Users of the website need to be able to upload images, which in the
current incarnation of the website I specified to be served /home/user/
website/images. This directory currently holds all images served with
the site, not just user uploaded images.
My 'packaging and distribution' practice currently consists of 'svn
exporthttp://svn-host/website/trunk', and then linking that to the
website directory, e.g. 'ln -s website-trunk-revision-189 /home/user/
website'.

I would just get the desired revision from svn and copy the source
files to the production directory. *You might need to clean out the
production directory first if you've removed any files.
Well, I can do all that in one fell swoop by creating a symbolic link.
I don't have to worry about whether or not I've deleted anything in
version control that I then need to remove in the production; it's
already done for me. If I had to delete files what were already
deleted in version control, then in my mind, I'm doing manual labor
that the computer should be doing anyway.

Also, by using symbolic links, I can deploy, test, and fallback to the
old directory by re-linking very easily if I need to.

Finally, by using an adequately named directory to symlink to, I know
what version I have deployed as production. If /home/user/website/
production is a symlink to /home/user/website/trunk-R255, then there's
a pretty good chance that it's revision 255 that is currently in
production. If I were just copying files into the website directory, I
would have to have another way to know or guess what revision was
actually deployed. I could reconcile my svn history against my bash
history, and try to extraploate what version is currently deployed,
but that takes some leg works and concluding. Of course, both ways are
subject to failure if you don't practice your procedures properly, but
I think symlinking is harder to screw up.

So, three good reasons to use svn exports in and symbolic linking to
deploy a website.
You're making this too complex. Subversion is for controling
revisions of your source code and related files (e.g. design docs),
nothing else. Once you put the application into production and have
begun accumulating user data, just copy the source files from a
working directory to the production directory using cp -r or a shell
script.
Well, I didn't *intentionally* make it to complex; my assumptions
about website design and structure sort of led me to the place that
I'm in now. :)

I'm making a dymanimc website where users can input data. The source
code of the website is under version control, and the user-generated
data is stored in MySQL. So far, so good. If I needed to re-generate
the website for any reason ( backup, new webhost, errant rm -rf ), all
I needed was a recent export from subversion and the latest MySQL
dump.

So now I think I'm beginning to understand the philosophy. In the
past, I could get away with keeping all the website images under /
images, or some similar structure. But now that I'm accepting user
data that I can't or shouldn't put into MySQL, I need to find a third
place to store things. I liked the simplicity of having the whole
website existing as svn export + mysqldump, so I was hoping there was
a way I could keep this new kind of data within that system. But I
can't. Now, the website must be mysqldump + svn + some other thing.
Oct 13 '08 #9
..oO(la*****@gm ail.com)
>On Oct 13, 11:30*am, Charles Calvert <cb...@yahoo.co mwrote:
>On Mon, 13 Oct 2008 06:23:48 -0700 (PDT), lawp...@gmail.c om wrote in
>My 'packaging and distribution' practice currently consists of 'svn
exporthttp://svn-host/website/trunk', and then linking that to the
website directory, e.g. 'ln -s website-trunk-revision-189 /home/user/
website'.

I would just get the desired revision from svn and copy the source
files to the production directory. *You might need to clean out the
production directory first if you've removed any files.

Well, I can do all that in one fell swoop by creating a symbolic link.
I don't have to worry about whether or not I've deleted anything in
version control that I then need to remove in the production; it's
already done for me. If I had to delete files what were already
deleted in version control, then in my mind, I'm doing manual labor
that the computer should be doing anyway.
That's what synchronizing is for. The computer can easily check which
files have been modified or deleted from the working copy and upload all
required changes to the production server. There are various tools
available for this task.
>Also, by using symbolic links, I can deploy, test, and fallback to the
old directory by re-linking very easily if I need to.
This should happen on a testing server. You hardly need multiple
versions on the production server.
>Finally, by using an adequately named directory to symlink to, I know
what version I have deployed as production. If /home/user/website/
production is a symlink to /home/user/website/trunk-R255, then there's
a pretty good chance that it's revision 255 that is currently in
production. If I were just copying files into the website directory, I
would have to have another way to know or guess what revision was
actually deployed.
You could use tags on your repository and then simply assume that it's
always the latest tagged version which goes production. When you reach
the next stable release, tag it and deploy it. Quite easy.

Micha
Oct 13 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11763
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem I have is I cannot retain the primary key field in a variable which is then used in a SQL update...
2
1876
by: Paul Gorman | last post by:
I am using the control type = file to perform a file upload. When I click on the browse button to go select the image I want to upload it places in the text box a local path (C:\images\image.jpg for example). This is where the image resides that I want to upload. Then I proceed to click on upload so that I can run through my code to do the upload process: string strConnection = "some connection string"; SqlConnection oCon = new...
2
2363
by: Tim T | last post by:
Hi, Could someone please point to to a tutorial / code for dynamically resizing images on upload, THEN saving to disk on the webserver. I need users to be able to upload images to my server, but they will not be aware of optimising graphics for the web, if someone uploads a 300k 640x480 jpeg for example, i need to be able to shrink it down to a - say 400x300 65k file BEFORE saving to my webserver. I have been looking on the web and have...
2
318
by: Ryan Moore | last post by:
I am creating a site that has an "Uploads" directory where users can upload image files (let's say .jpgs and .gifs). When a user uploads an image, the system creates a directory within this "Uploads" directory to place their image in. What I would like to do is protect the ENTIRE uploads directory so a user cannot navigate directly to http://mysite/uploads/2/img.jpg without logging into the site first (I'm using forms authentication). I'm...
7
3400
by: Scott Schluer | last post by:
Is there a way to use the Image class to convert a color photo (GIF or JPEG) to a B&W photo? Thanks, Scott
7
3346
by: Jake Barnes | last post by:
I've a little webcam program that snaps a picture of me and uploads it every 20 seconds. It automatically uploads the image to my server. It always give the image the same name, and thus it overwrites the image that has been there for the last 20 seconds. People can, if they wish, hit the refresh button every 20 seconds, but I thought it would be fun to have a Javascript function that actually refreshed the image. However, this following...
9
2594
by: tshad | last post by:
This was posted before but the message got messed up (all NLs were stripped out for some reason). I have 2 labels that hold the name of different images on my .aspx page. <asp:Label ID="Logo" runat="server"/> <asp:Label ID="CompanyPicture" runat="server"/> I have 2 links that open the windows to preview these images. The previewed images are done on separate html pages that do nothing but display the
3
1225
by: adamjblakey | last post by:
Hi, Can anyone see what is wrong with this function. The problem is that when it creates the 450px image it comes out black and not in colour like the thumbnail. Any ideas? <?php function uploadimage($value){ $file_type = $value; $file_name = $value;
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9399
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9957
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9835
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.