John Burtt
asked this on June 07, 2010 00:45
I have a database table that includes a column of type "blob". This column will hold a small (90 x 90) image. Is this the way to go when needing to save an image? Or, should I just save a path to the image? If I can save the image to the database table, can you tell me how that might be done?
Thanks for your help, John
Comments
Saving the image to the database is pretty straight forward as SQL Yoga will use the proper RevDB commands under the hood. If you create a record using a SQL Query object (as in this example) you would just put the binary data of the image into the array you use to create the record in the db.
put URL("binfile:/Path/to/image.png") into theRowA["image_data"]sqlquery_create "lessons", theRowA
Now, as to whether or not you should store the image in the database really depends. Personally I don't normally store images in a database but have them on disk. I find it is easier to update the image that way. Your needs may be different though.