views:

165

answers:

4

I'm currently importing all of our PHP websites into SVN repositories. Each site has a images folder which contains all the sites images. The images are updated quite frequently as most of them are offer graphics.

Should the images (binaries) be stored in the repository?

The other issue is that they are updated all the time. How would you update images frequently that are in your working copy as you can't edit the source in a text edit like you would a source file they would need to be replaced with updated images, how would the version system handle this?

+2  A: 

If you want to see a "SNAPSHOT" of your site in a given time (Track the appearance in history) then the answer is YES :).

Chathuranga Chandrasekara
+3  A: 

SVN is capable to handle binary files, including (but not limited to) images. You can use it like a normal text file. The only difference is once changed, it's changed as a whole, not as a patch like normal text files.

nanda
So if I wanted to replace a batch of images would I just replace the images in my working copy with new ones and then commit the working copy to the repository?The reason I ask is because I did not think you could create new files and folders in working copies and updating images would essentially require you to replace one image with a new one of the same name.
Camsoft
SVN is pretty smart to detect the change. You can anything to the file and next time you do a commit, it will do the detection for you.One note, though, if you want to delete or add files/directories, you will need to explicitly call specific svn command for that.
nanda
+1  A: 

We tend to try not to include "content" type images (or other binaries) in SVN, as many of the sites we deal with have large collections of high-res images and PDFs for users to download. These make the checkout from SVN, for a developer who's just working on the code, a very long task.

One idea was to have two separate repositories; one for code and one for "non-code" binaries (i.e. general content). Then create a "release" script for each site which can export the appropriate parts of each repo to create a complete site. That also means our content team can play around with content binaries without risking them getting their sticky fingers into the code repo ;)

Matt Sach
Interesting idea, though I need to keep this as simple as possible. As I have a different repository for each site I would have to create scripts for each one.
Camsoft
Yes, that would be a bit of a pain. We have a single code repo with subfolders per project, so we'd probably make a second for content (mirroring the folder structure) and write a tool that would take a folder name and automate the rest of the export.
Matt Sach
A: 

As you define your project as a "website" I think you should keep.. You'll know that your entire project is in the same place, versioned, backed up. Your images are a part of your project as well.. They also change often or worked by multiple people.

SVN can hold and version different types of files... Of course there are some limitations on binary files. But you can still enjoy hassle-free working among teams with SVN.

Using hook scripts is a good way to deploy your site on FTP hosts or on your local computer. By using a simple post-commit script you can copy your site to a test URL and avoid copying the site each time someone makes changes..

Gökçen Öğütçü