Forum: Ruby on Rails file_column image versions

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.
Josh K. (Guest)
on 2006-06-06 23:02
does anyone know much about resizing different versions of images with
file_column? i tried it and everything works fine, but my question is
can you do more than just make sizes with a version of image? i'm
working on a photo album and i would like to resize the image to a
medium size, but create a thumbnail as well and crop anything left to
make the thumbnail a perfect square.
Alex W. (Guest)
on 2006-06-07 00:13
Josh K. wrote:
> does anyone know much about resizing different versions of images with
> file_column? i tried it and everything works fine, but my question is
> can you do more than just make sizes with a version of image? i'm
> working on a photo album and i would like to resize the image to a
> medium size, but create a thumbnail as well and crop anything left to
> make the thumbnail a perfect square.

Try SuperImage instead.  It supports dynamic resizing of images at
runtime, and includes options to crop to a specific size.

  http://mydomain.com/images/123?size=125x125&crop=true

I believe file_column only creates the image version when you first
upload the image, but SuperImage allows you to dynamically generate what
you need.
Alex W. (Guest)
on 2006-06-07 00:15
Alex W. wrote:
> Josh K. wrote:
>> does anyone know much about resizing different versions of images with
>> file_column? i tried it and everything works fine, but my question is
>> can you do more than just make sizes with a version of image? i'm
>> working on a photo album and i would like to resize the image to a
>> medium size, but create a thumbnail as well and crop anything left to
>> make the thumbnail a perfect square.
>
> Try SuperImage instead.  It supports dynamic resizing of images at
> runtime, and includes options to crop to a specific size.
>
>   http://mydomain.com/images/123?size=125x125&crop=true
>
> I believe file_column only creates the image version when you first
> upload the image, but SuperImage allows you to dynamically generate what
> you need.

Oops, forgot link:
http://beautifulpixel.com/super_image/index.html
Josh K. (Guest)
on 2006-06-07 00:20
Alex W. wrote:
> Alex W. wrote:
>> Josh K. wrote:
>>> does anyone know much about resizing different versions of images with
>>> file_column? i tried it and everything works fine, but my question is
>>> can you do more than just make sizes with a version of image? i'm
>>> working on a photo album and i would like to resize the image to a
>>> medium size, but create a thumbnail as well and crop anything left to
>>> make the thumbnail a perfect square.
>>
>> Try SuperImage instead.  It supports dynamic resizing of images at
>> runtime, and includes options to crop to a specific size.
>>
>>   http://mydomain.com/images/123?size=125x125&crop=true
>>
>> I believe file_column only creates the image version when you first
>> upload the image, but SuperImage allows you to dynamically generate what
>> you need.
>
> Oops, forgot link:
> http://beautifulpixel.com/super_image/index.html

how is this on speed? i'm working on a site that has high traffic loads
so i think i would rather have the images already generated beforehand.
Alex W. (Guest)
on 2006-06-07 00:24
Josh K. wrote:
> Alex W. wrote:
>> Alex W. wrote:
>>> Josh K. wrote:
>>>> does anyone know much about resizing different versions of images with
>>>> file_column? i tried it and everything works fine, but my question is
>>>> can you do more than just make sizes with a version of image? i'm
>>>> working on a photo album and i would like to resize the image to a
>>>> medium size, but create a thumbnail as well and crop anything left to
>>>> make the thumbnail a perfect square.
>>>
>>> Try SuperImage instead.  It supports dynamic resizing of images at
>>> runtime, and includes options to crop to a specific size.
>>>
>>>   http://mydomain.com/images/123?size=125x125&crop=true
>>>
>>> I believe file_column only creates the image version when you first
>>> upload the image, but SuperImage allows you to dynamically generate what
>>> you need.
>>
>> Oops, forgot link:
>> http://beautifulpixel.com/super_image/index.html
>
> how is this on speed? i'm working on a site that has high traffic loads
> so i think i would rather have the images already generated beforehand.

As long as you use cacheing there will be no difference.  The initial
generation of each image will be a small hit, but page_cacheing makes it
snappy after that.

  class MyControllerNameController < ApplicationController
    include SuperImagePlugin::Show
    image_action :show_my_image
    caches_page  :show_my_image
  end

would do the trick.
Kyle M. (Guest)
on 2006-06-07 19:34
(Received via mailing list)
On 6/6/06, Josh K. <removed_email_address@domain.invalid> wrote:
> does anyone know much about resizing different versions of images with
> file_column? i tried it and everything works fine, but my question is
> can you do more than just make sizes with a version of image? i'm
> working on a photo album and i would like to resize the image to a
> medium size, but create a thumbnail as well and crop anything left to
> make the thumbnail a perfect square.

http://svn.kylemaxwell.com/file_column (my file_column branch).
There's no "versions".  Instead, you can specify one initial, optional
transformation, using the ImageMagick command-line syntax:

file_column :image_field, :magick => "-resize 1000x"

And you can specify an arbitrary number of view transformations using:

<%=url_for_file_column "model", "image_field", :magick => "-rotate 90
- resize 40x10!" %>

--
Kyle M.
Chief Technologist
E Factor Media // FN Interactive
removed_email_address@domain.invalid
1-866-263-3261
HH (Guest)
on 2006-06-07 19:59
(Received via mailing list)
Is Sebastian still maintaining file_column?

Do you see any potential to merge your versions or take over
development?
Josh K. (Guest)
on 2006-06-07 20:05
i actually got what i wanted. i accomplished it with this in my model:

class Photo < ActiveRecord::Base
  file_column :image,
              :magick => { :versions => { :thumb => { :crop => '1:1',
:geometry => '50x50' },
                                          :medium => { :geometry =>
'400x400>' }
                                        }
                         }
end
This topic is locked and can not be replied to.