matt wrote:
I’m using FlexImage to upload files, and I want to also be able to go
back and edit the file.
So an edit operation would produce the name of the file that was
uploaded, and produce a thumbnail for visual reference, with the ability
to delete this image entirely, or to change it’s uploaded path/image.
The thumbnail would be created when it’s requested, rather than at
upload. To create the thumbnail when it’s uploaded, use file_column
instead.
Would I need to add a column to my Images table to save the uploaded
path, and then populate the file_field with that value? (Is there even a
way to populate the file_field with a previous value?)
The filestore is defined once for the entire class. It’s not really
designed to start moving the stored images around in various places on
the filesystem. You will have to roll your own solution for that.
I’m not really getting what you are trying to accomplish here. Would it
make more sense to have a dynamic route that simply requests the proper
image based on some attribute rather than physically moving the images
around the filesystem of your server?
What is the best way to display multiple images that are already in the
database from a FlexImage upload?
Remember your HTTP basics here. 1 request from the browser, 1 response
from the server. You can’t send multiple responses to the same request.
To put mulptiple images on a page, simply put the html for multiple
image tags on that page. Then the browser will send a specific request
for each image
<% @item.images.each do |img| %>
<%= image_tag :action => ‘image’, :id => img %>
<% end %>
Then your controller gets a request for each image, with that image’s
id, then sends the image data.
Can render_flex_image() take an Array of images?
No. Since you can only send 1 response per request, you can only render
1 image per request.