AttachmentFuAppEngine
Extension for AttachmentFu (github.com/technoweenie/attachment_fu) which uses the Google App Engine for storage and image resizing. Removes the need to install ImageMagick and allows you to add or change thumbnail sizes without migrating previous data.
The Google App Engine backend code is included so you can run it in your own App Engine instance.
Example
class Photo < ActiveRecord::Base
:storage => :app_engine, :thumbnails => {:small_square => "45x45!"}
end
AttachmentFuAppEngine attempts to reproduce the resize format from ImageMagick.
-
“100x100” - scale the image to fit within a 100x100 box (the larger dimension will be 100, such as 100x75), preserving the aspect ratio. Will scale up small images.
-
“100x100!” - scale the image to be exactly 100x100 by scaling proportionately and cropping off the edges. Will not distort the image but may hide part of it.
-
“100x100>” - scale the image to be at most 100x100 - smaller images will not be enlarged.
In addition to the standard thumbnail specification: Image.find(1).public_filename(:small_square)
you can also use: Image.find(1).public_filename(‘40x40!’)
Installation
gem install larsklevan-attachment_fu_app_engine -s gems.github.com OR script/plugin install git://github.com/larsklevan/attachment_fu_app_engine.git
Migration
You can use the provided rake task to move data from S3 to the App Engine. Just run: rake ATTACHMENT_CLASS=Image migrate_s3_to_app_engine
Configuration
You can use your own instance of the App Engine code to store images so you have your own quotas. Use the provided app engine code and configure the URL as follows:
Technoweenie::AttachmentFu::Backends::AppEngineBackend.base_url = “attachment-fu-gae.appspot.com”
Limitations
-
Tested with Rails 2.1 only
-
Google App Engine is in early release, so if you go past your daily storage/bandwidth/CPU limit you are out of luck.
-
Google App Engine does not support HTTPS.
-
Google App Engine currently has a limit of 1MB per reocrd
For more information about the status of the App Engine see googleappengine.blogspot.com/2008/04/were-up-and-running.html
Copyright © 2008 Lars Klevan, released under the MIT license