Hello everyone,
We've got a cool new feature for you called HerokuAssets.
Many apps deal with static asset storage in some form - file uploads
being the typical example. In the distributed world of cloud
computing, storing such files in the local file system doesn't scale
well, so we want to provide you with a better solution. HerokuAssets
is a dead-simple way for you to seamlessly harness the power of
secure, centralized storage for your assets through S3.
If you're using attachment_fu, switching to HerokuAssets is a total
breeze. Just tell your models to use the new backend we've created
like this:
class Photo < ActiveRecord::Base
has_attachment :content_type => :image,
:storage => :heroku,
:resize_to => '200x200>',
:thumbnails => { :thumb => '50x50>' },
:processor => 'Rmagick'
end
...and you've got yourself fast file storage that scales! This will
only work while the app is hosted on Heroku. We're going to make
this totally seamless with attachment_fu, falling back to a different
storage method in a local environment. For now, this will do the trick:
:storage => defined?(HerokuApp) ? 'heroku' : 'file_system'
We have some stuff in the works for to make this a little more
automagical, but first we wanted to get this out to you guys and
start collecting feedback. If you're using another plug-in , or just
need direct access to the API that's easy too. Here's how you use it:
=== Create a new asset ===
HerokuAssets.put('image.jpg', File.read('image.jpg'))
=== Retrieve an existing asset ===
HerokuAssets.get('image.jpg')
=== Rename an existing asset ===
HerokuAssets.rename('image.jpg', 'renamed_image.jpg')
=== Delete an asset ===
HerokuAssets.destroy('image.jpg')
=== Get the full S3 URL for an asset ===
HerokuAssets.temporary_url_for('image.jpg')
=== List all assets for your app ===
HerokuAssets.list
That's it! It's ready to use, so do take it for a spin and tell us
what you think.
Best,
/Morten
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Heroku" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en
-~----------~----~----~----~------~----~------~--~---