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.
F639e0cdf2fa098b535d6ec766b2aee1?d=identicon&s=25 Szymon Nowak (g0nzo)
on 2006-03-08 18: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.
Bf66e10c8fc4abefebde0425e7f6f15a?d=identicon&s=25 Norman Timmler (Guest)
on 2006-03-08 19: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 Timmler

http://blog.inlet-media.de
F639e0cdf2fa098b535d6ec766b2aee1?d=identicon&s=25 Szymon Nowak (g0nzo)
on 2006-03-08 22:55
Thanks!!!
This topic is locked and can not be replied to.