Tutorial :Best Practice for Subversion and Image Uploads



Question:

Running an ASP.Net website and using TinyMCE for content management. Users need to be able to upload images for content. The images will be shown in website content (news, articles, etc) but won't otherwise be referenced by anything aside from their content.

Should these images be under version control (svn), or should the upload directory just be passed around when needed (backup, testing, etc)? If they should be versioned, what's the best way to do this?


Solution:1

The content is not a part of the application just the instance you have running so it should be added to your backup not your SVN repository. I only add images to SVN if there are apart of the application it self.


Solution:2

I think you want to make a periodic backup of those images.

SVN is great, but if you want to use it for user content you have to implement SVN in the frontend of your application as well since otherwise it's not going to be of any use.

If you have SSH access you could schedule a job to backup the images periodically.


Solution:3

There's no reason not to store images in your version management repository, and it makes a great tool for handling changes-of-mind, who-did-what and how things evolve over time.

The only thing you need to do is ensure that you have the needs-lock property on these files - last thing you want is for users to get a file, modify it, then attempt to check it in only to find someone else has modified it already. Normally this is not a problem due to the merge ability of SVN, but its a bit tricky to merge image files. So, put the needs-lock property on and only 1 user can modify an image at a time.

ah.. just read it again, do you mean user-uploaded content that is not part of your website? In which case, why do you need those images at all - back them up of course, but otherwise do you need them at all anywhere other than on the live website?


Solution:4

I usually create a diiferent subversion control for the images. Let's say you have a project consisting of source codes and images, I create two subversions as below:

$ svnadmin create my_project

and

$ svnadmin create my_project_images

By making any change to an image, I just remove that image from subversion control fist and then add the modified image. This is useful for cases that the number of times that images would change are considerably less than that of source codes, which are under my_project subversion control. This way I can share my projects containing binary data with others using SVN.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »