You can just read all the files in the directory and create image tags
for them dynamically. If you give the filenames good descriptive names
you won''t have to hard-code anything, either.
For example, if you have "House Next to Lake.jpg", "Sunset in
Santa
Cruz.jpg", etc., you can then do something like:
<% for image_path in Dir.entries(path_to_images) -%>
<%= image_tag image_path %><br>
<%= image_path[/(.+)\./,1]
<% end %>
If you want the images in a specific order you could pre-pend a number
to each image filename, sort the list of images, and then just strip
it off with the regex.
HTH,
Matt
On Mar 29, 12:24 pm, Jacob Lichner
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> I''m creating a very simple photography portfolio site. I would
like to
> set this up so that my application recognizes and pulls photos from a
> given directory (images folder) automatically. This way the entire
> site''s images can be maintained by simply adding and removing via
ftp.
>
> What''s the simplest way to go about this? Do I need an xml file?
Please
> be as specific as possible and thank you! in advance.
>
> (In the end, I plan on having a directory for each of the categories...
> portraits, landscape, wedding, etc.)
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---