On 2 September 2010 11:22, johnnybutler7 <[email protected]> wrote: > Am i right in saying its better practice to provide a link to the > image file in the xml if possible rather than embedding the actual > image. It seems > a bit of a recipe for disaster parsing binary data in an xml file and > decoding to an image.
Well if you put the image in the xml as base64 they you don't have to worry about losing files. Just copy the xml file and you have everything you need. What would be helpful of course would be for the xml to contain the meta information about the image such as: <image encoding="base64" mime-type="image/jpeg" filename="McNicholl_IMAGE_005.jpg">...</image> Then you would have no problem decoding the file. However the xml file is going to get big very quickly and could become unwieldily and difficult to edit. As a side note I have checked some files on my disk and gif images start R0lGODlh... in base 64, jpgs start /9j/4AAQSk... and pngs start iVBORw0KG... So if the base64 was an actual image format and you did not have the mime-type available then inspecting the first few characters of the should give you a good chance of getting the format correct. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

