Forum: Ruby on Rails Creating new Magick::Image from uploaded data

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Szymon N. (Guest)
on 2006-03-08 19:13
Hi!

Is it possible to create a new instance of Magick::Image out of uploaded
data via file input?

Now i save my file to the disk, then read it to create an instance of
Magick::Image, resize it and save it again.
Norman T. (Guest)
on 2006-03-08 20:30
(Received via mailing list)
Am Mittwoch, den 08.03.2006, 18:13 +0100 schrieb szymek:
> Hi!
>
> Is it possible to create a new instance of Magick::Image out of uploaded
> data via file input?
>
> Now i save my file to the disk, then read it to create an instance of
> Magick::Image, resize it and save it again.
>

Yes. See this example:

def file=(new_file)
  new_file.rewind
  image = Magick::Image::from_blob(new_file.read).first
end

--
Norman T.

http://blog.inlet-media.de
Szymon N. (Guest)
on 2006-03-08 23:55
Thanks!!!
This topic is locked and can not be replied to.