Hi;
I am using Ruby on Rails, I have uploaded 2 images in jpeg format to
a database model called Imagen
via Rails using the acts_as_attachment plugin, I can generate
thiumbs, display them, etc... so far so good...
Now, once uploaded to the database, I need to use this two images to
generate a morph using RMagick
and have it's result as an animated "GIF" image; then I want to
display it in a view.
This is what I have but it is not working, I would appreciate help in
finishing this code:
In the controller I have this:
def create_preview
imagenleft = Imagen.find(:first, :conditions => ["parent_id = ?
and thumbnail = 'normal'", 5])
imagenright = Imagen.find(:first, :conditions => ["parent_id = ?
and thumbnail = 'normal'", 7])
imagenleftdata = DbFile.find(imagenleft.db_file_id).data
imagenrightdata = DbFile.find(imagenright.db_file_id).data
@imagenes = [imagenleft, imagenright]
i = Magick::ImageList.new
i.push.from_blob(imagenleftdata).format = "GIF"
i.push.from_blob(imagenrightdata).format = "GIF"
morph = i.morph 8
morph.delay = 12
morph.iterations = 10000
@imagenpreview = morph
end
This is what I have in the create_preview.rhtml view:
<h1>Show Morph: </h1>
<% @imagenes.each do |imagen| -%>
Name: <%= link_to (imagen.filename, :action => 'show_photo', :id
=> imagen) %> <br/>
<img src="<%= url_for(:action => 'render_photo', :id => imagen.id)
%>" />
<% end -%>
<img src="<%= @imagenpreviewtest %>" />
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users