Forum OpenACS Q&A: Newbie - Playing with Images and a Database in OpenACS?

What is the best way to play with graphics files and a database.  Do I store the blob image in postgres and retrieve the images from there and display it to the screen?  Or is it better to store these image files on the HD and save the path to images in the database and retrive the image using the stored path and file name?

How does OpenACS work with images?  Are there articles to read about the topic?

Here is what I want to accomplish:  I have say a 2 dozen or so image files (very small, less than 2K) that will grow in numbers over time, and I want to have an ad-form where a user can select from this collection of images. Perhaps a preview/thumbnail of what the images are (they are fairly small anyways), and a little checkmark beside each one, and a user shout be avlbe . The same image can be selected by more than 1 person.

I apologize prefusely, as I am a new user of OpenACS.

Collapse
Posted by Don Baccus on
No need to apologize!

Use the content repository, that's the simple answer.  It allows you to chose whether to store the binary data in the database or the filesystem, and there's some upload helper Tcl API available in the revision-procs.tcl library file.  The Tcl API isn't as complete as we'd like (and we keep adding to it) but it should help you get started.

There's an image content datatype predefined in the content repository already and the Tcl API code I refer to above knows about the image type.

You might also take a look at the photobook application, probably the version in contrib which has been recently enhanced with bulk upload features and the like.  Hacking that would be a lot easier than writing your own package IMO.

Collapse
Posted by garry g on
Thank you Don, I will look into that.
If you could make up easy documentation on what you find, that would help others out in the future 😊

If you produce something in HTML and don't want to host it on your site, I'd be happy to put it on my site.