I’ve been toiling away at another Asset Management extension -
originally I started just playing round with Keith’s extension, but I’m
pretty much dumped all that code now.
This extension requires that you’re running on the mental branch, and
that you also have my admin_parts extension installed:
Features of this extension:
Images are linked to each page, rather than being global.
Local images can be displayed with:
Images from another page with:
Images can be manipulated using FlexImage
(http://beautifulpixel.com/flex_image/index.html). Just dump a
transform_name.flexi file into ‘app/views/assets’ and you can transform
@image.resize! :size => ‘100x100’
@image.border! :size => 3
And in the page:
<r:image name=“monkey.jpg” transform=“polariod”/>
There’s also a default.flexi that all images are passed through - these
files contain just ruby code and get passed both the @asset and the
owning @page, so you could do default transformations depending on the
type of page involved.
If FlexImage isn’t installed, the extension can continue to be used as a
basic asset management system.
This isn’t complete. I don’t have:
- a way to upload images for a page that hasn’t been created
- a nice way to delete images
- much in the way of validation
- anything in the way of tests (it’s probably going to crash
early and often)
- any caching whatsoever (your CPU will likely get choked if you
try running this in production with transforms under even slight load)
- any confidence that it wont destroy all your data or kill your
first born child (use at own risk)
I’m pretty excited about how this extension is turning out - I’d love
some feedback, and any offers of patches are always welcome.