Thank you very much for the suggestions but it's not quite
what I'm
looking for.
I think what I'm having trouble with is more basic.
What I want to be able to is access the file size (and
other
attributes) outside, from an rhtml file.
I have done this successfully by adding this line to the
rhtml file:
<%= Magick::ImageList.new(photo.image).filesize
%>
Although this works, it incurs a massive time penalty,
somewhere
around 1 second per image.
I think the best method would be to get the size and store
it when the
image is saved, which is why I thought of putting this
beneath line 5:
size = image.filesize
however that does nothing so far as I can tell.
I had another thought - defining this function at the start
of the
class:
def store_size(image)
size = image.filesize
end
and adding this beneath line 5:
store_size(image)
however this gives the error 'undefined method
`write_description' for
Photo:Class'
So how do I call a function on the object rather than the
class from
the block starting at line 5?
Thanks again!
--~--~---------~--~----~------------~-------~--~----~
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 googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
|