Displaying 17 results from an estimated 17 matches for "change_geometry".
2007 Apr 19
2
invalid geometry string in change_geometry
I get the following error at the browser:
ArgumentError in ImagesController#upload
invalid geometry string `110×''
... for the call 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.im...
2005 Dec 19
3
RMagick Resizing Issue
Hello ~
I have RMagick and file_column working in RoR. In my model I am setting up
some standard sizes for the submitted photos. The photo files are created
and named correctly, but the sizes are wrong. Only the second argument of
my geometry call is used, with the width dimension being resized
proportionately.
file_column :image, :magick => { :versions => { "medium" =>
2006 May 30
1
Can''t read from file field second time around
...age=(image_field)
self.image = image_field.read
self.content_type = image_field.content_type.chomp
end
def resize
img = nil
img = Magick::Image.from_blob(self.image).first
img.format = "JPG"
case self.image_type
when "thumb"
img.strip!.change_geometry("120x120!") { |cols, rows, img|
img.resize!(cols, rows) }
when "med"
img.strip!.change_geometry("320x320>") { |cols, rows, img|
img.resize!(cols, rows) }
when "lg"
img.strip!.change_geometry("640x480>") { |cols, row...
2006 Feb 03
3
File_column and rmagick options
Hi,
Currently I''m using the file_column plugin to upload images and save
multiple copies of each at 3 different resoltions:
file_column :name, :magick => {
:versions => { "thumb96" => "96x150>", "medium250" =>
"250x400>", "large480" => "480X640>" }
}
I am wondering if
2006 May 16
0
Image format gotcha
...--Al Evans
-----
#!/usr/bin/env ruby
require ''RMagick''
include Magick
# name of original photo without extension
def photo_basename(name)
name.gsub(/\.\w+$/i, '''')
end
def make_image_cache(pic_file_name)
img = Image.read(pic_file_name).first
img.strip!.change_geometry("1024x1024") { |cols, rows, img|
img.resize!(cols, rows)
}
img.write("#{photo_basename(pic_file_name)}.MPC")
img = nil
GC.start
end
def make_image_workfile(pic_file_name)
img = Image.read("#{photo_basename(pic_file_name)}.MPC").first
img.strip!.change_...
2006 Apr 24
0
ImageMagick and EXIF Data
...lsize
create_fullsize
create_thumbnail
load_exif_data
@file_data = nil
end
end
def save_fullsize
File.open(path,''w'') do |file|
file.puts @file_data.read
end
end
def create_fullsize
img = Magick::Image.read(path).first
img.change_geometry!(''700 x 700'') { |cols, rows, large|
large.resize!(cols, rows)
large.write path
}
end
def create_thumbnail
img = Magick::Image.read(path).first
img.change_geometry!(''200 x 160'') { |cols, rows, thumbnail|
thumbnail.resize!(cols,...
2008 Jan 22
4
Calling a function
...4: end
5: file_column :image, :magick => {
6: :versions => {
7: "thumb" => {
8: :transformation => Proc.new { |image|
9: store_description(image) # what do I put
here???
10: image.change_geometry!(''160x120'') { |cols,
rows, img|
11: img.thumbnail!(cols, rows)
12: }
13: },
14: :attributes => { :quality => 50 }
15: }
16: }
17: }
18: end
Thanks!
--~--~---------~--...
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 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 Jul 25
1
How do I validate using associated objects?
...arent_thumbnail_at_width)
y = comment.board.setting(:parent_thumbnail_at_height)
else
x = comment.board.setting(:reply_thumbnail_at_width)
y = comment.board.setting(:reply_thumbnail_at_height)
end
if @thumbnail.columns > x or @thumbnail.rows > y
@thumbnail.change_geometry!("#{x}x#{y}") {|cols, rows, img|
img.resize!(cols, rows)}
end
end
def validate_on_create
errors.add_to_base(comment.board.language(:error_toobig)) if
self[:image_width] > comment.board.setting(:maximum_image_width)
end
end
--
Posted via http://www.ruby-forum.com/.
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
3
file_column Cropping -> image offset information
Hello,
I had a problem cropping images with file_column. These are my settings:
file_column :image, :magick => {
:versions => {
:thumb => "80x80>",
:medium => "150x150>",
:square => {
:crop => "1:1",
:size => "50x50!"
}
},
2005 Oct 11
8
resize images
Hi,
I am looking for the best solution to resize images to fit within a
certain area. The images will only be made smaller if they will not
fit within a fixed size area. It is important to maintain the same
proportions.
This ImageMagick extension looks promising:
http://vantulder.net/rails/magick/
However, I believe it may be overkill for just resizing images
sometimes. I have also seen a
2006 Apr 07
4
file_column and animated gifs
hi,
is it possible to resize animated gifs with file_column?
if i upload an animated gif file with file_column than the animation no
longer exists...
--
Posted via http://www.ruby-forum.com/.
2007 Mar 28
3
attachment_fu Not Resizing
Hello,
Recently attachment_fu stopped resizing images for me. I''m puzzled
because before today it was resizing them and I don''t know what''s
changed. Here''s my code:
class Product < ActiveRecord::Base
has_attachment :content_type => :image,
:storage => :file_system,
:max_size => 18.megabytes,
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:
2005 Jun 06
14
Handling Images And Rails
On my website people will be able to upload images of themselves. I
was wondering how people are presently handling uploading, resizing
and optimizing images in Rails? Do you use a specific piece of
software to do it? What would you guys recommend? Any code from
RailsDay? :-)
Also, do you guys store the images in the DB or just as files? What
do you suggest? What are the pros and