Neeraj Kumar
2007-Apr-13 18:32 UTC
How to read image data offline without using the browser
Hi, I uploaded a lot of images and resized them using RMagick and everything is working fine. Now I need to resize the existing images to some different dimenstion. In my existing controller all the processing starts after I have params[:image][:data] in my controller. My question is how do I get the image data when I am reading the file. Does anyone have an existing code to read an image and get something similar to params[:image][:data] ready for processsing. I knwo how to read an ASCII file but don''t know how to read an image file. Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Alex Wayne
2007-Apr-14 00:12 UTC
Re: How to read image data offline without using the browser
Raj Singh wrote:> Hi, > > I uploaded a lot of images and resized them using RMagick and everything > is > working fine. > > Now I need to resize the existing images to some different dimenstion. > In my > existing controller all the processing starts after I have > params[:image][:data] in my controller. > > My question is how do I get the image data when I am reading the file. > Does > anyone have an existing code to read an image and get something similar > to > params[:image][:data] ready for processsing. I knwo how to read an ASCII > file but don''t know how to read an image file. > > ThanksYou can get an Magick::Image object that you can manipulate with a snippet like this: img = Magick::Image.read(''/path/to/file.jpg'').first img.crop_resized!(400, 300) -- Posted via http://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 -~----------~----~----~----~------~----~------~--~---