Displaying 12 results from an estimated 12 matches for "from_blob".
2007 Apr 19
2
invalid geometry string in change_geometry
...l to change_geometry with an explicit size (''110x'') as
the geometry string:
def make_thumb (the_img)
require ''RMagick''
size = "110x"
debugger if ENV[''RAILS_ENV''] == ''development''
img = Magick::Image.from_blob(the_img.img_data).first
img.change_geometry(''110×'') {|cols, rows, i| i.resize!
(cols,rows) }
# img.change_geometry("110×") {|cols, rows, i| i.resize!
(cols,rows) }
# img.change_geometry("#{size}") {|cols, rows, i| i.resize!
(cols,rows) }
end
.....
2006 May 30
1
Can''t read from file field second time around
...iece of code takes an uploaded image and resizes it. It''s a bit
nasty at the moment as I am still messing around with it. What I can''t
understand is why it works for one iteration but then fails with:
zero-length blob not permitted `''
On the line:
img = Magick::Image.from_blob(self.image).first
I am basically doing this in the controller and it fails on the second
attempt - to resize and save the medium size image:
if @params[:listing_image]
@thumbnail_image = ListingImage.new(@params[:listing_image])
@listing = @session[:listing]
@thumbna...
2008 Dec 04
2
Does animated gif will work properly using RMagick?
...RMagick. But the animated gif which i read was witten in my
folder without animation. What should i do to write the gif image with
animation.
Here is my code to read and write image while uploading.
image = params[:image][:blob]
image1=params[:image][:blob].original_filename
imgs = Magick::Image.from_blob(image.read)
img = imgs.first
File.open(RAILS_ROOT + "/public/images/banner/" + image1 , "wb") do |f|
f.write(img.to_blob)
end
could anyone suggest me to solve this issue
Thanks in advance,
Regards,
Jose Martin
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~...
2006 Jul 25
1
How do I validate using associated objects?
...Comment < ActiveRecord::Base
belongs_to :board
has_many :uploads
end
class Upload < ActiveRecord::Base
belongs_to :comment
end
class Image < Upload
before_create :create_image
before_create :create_thumbnail
def create_image
@image = Magick::ImageList.new.from_blob(@upload_blob)
self[:image_width] = @image.columns
self[:image_height] = @image.rows
end
def create_thumbnail
@thumbnail = Magick::ImageList.new.from_blob(@image[0].to_blob)
if comment.parent_id == nil
x = comment.board.setting(:parent_thumbnail_at_width)
y = comm...
2006 Mar 23
0
Reading image file field data directly into RMagick
I''m trying to read image data from an upload file field directly into
an RMagick image object without having to temporally save the image
file first. Assuming my file field param is assigned to @temp_file, i
tried RMagicks from_blob method:
img = Magick::Image::from_blob(@temp_file.read)
But i get an error message saying that the blob is empty. I also
tried feeding it the entire IOString object returned by the file
field, but it can''t deal with it either. Anybody knows how this can
be done? Thanks.
sebastian
2006 May 19
9
Resize uploaded image file without creating temp file?
Hi,
I need to take a single uploaded image file and save three resized
versions of it, a thumbnail, normal and large version. I was planning on
doing this in my model by having an array of geometry strings and looping
through them, each time saving a new image object resized to the correct
geometry. I know that file column does similar stuff, but I would prefer
to have a separate database row
2006 Apr 27
7
SuperImage plugin
Greetings all,
This is the first release of the SuperImage plugin. The idea is you
upload images to the database, and then pull them out at any size you
want. Combine this with caching and it will stay light and fast.
More info and instructions are here:
http://beautifulpixel.textdriven.com/articles/2006/04/27/superimage-plugin-making-resizeable-uploaded-images-easy
svn:
2006 Jul 22
7
Validation with has_many
I have two problems. I have a comment that has_many uploads. Before
saving the comment, I want to be sure that the upload(s) has passed
validation, but I also need to validate in other ways. For example, I
do not want to save the comment if there is no comment or upload. Or, I
do not want to save the comment if the image has been uploaded
previously (comparing md5s with past upload md5s
2006 May 10
0
Saving extracted data
...ta.original_filename)
write_attribute("file_size", file_data.size)
read_attributes(file_data)
end
I also want to read the attributes of the EXIF data embedded in the picture
doing something like this (this the short form):
def read_attributes(file_data)
img = Magick::Image.from_blob(file_data.read)
camera_makeimg.get_exif_by_entry(''Make'')
write_attribute("camera_make", camera_make)
end
However, when I do this I get an error of:
undefined method `get_exif_by_entry'' for [ JPEG 3504x2336 3504x2336+0+0
DirectClass 8-bit 3544kb]:Arr...
2006 May 17
0
send_data not working properly with link_remote_to
...pdate => "img",
:url => {:action => "flip"}
)%>
<div id="img"></div>
controller:
def flip
filename="/public/picture/filename/1/scaler_1.jpg"
img=File.read(filename)
ilist = Magick::ImageList.new
@picture=ilist.from_blob(img)
@picthumb=@picture.flip!
@out=@picthumb.to_blob
send_data(@out,:filename =>''workshopimage'', :type => "image/png",
:disposition => "inline")
end
the above doesnt work
but with my view as
<%= link_to("flip",
:action =...
2006 Apr 23
2
file_column and Thumbnails
I see that the SVN version of the excellent file_column plug-in can create
thumbnails using the url_for_image_column helper.
This uses Rmagick to create the thumbnail... Quick question...
Let''s say the file is a TIFF image - can the helper create a JPG version of
the thumbnail for display in the browser?
Curious if the plug-in can handle that transform with some creative use of
the
2006 Mar 08
2
Creating new Magick::Image from uploaded data
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.
--
Posted via http://www.ruby-forum.com/.