New Asset Management Extension


#1

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.

http://soxbox.no-ip.org/radiant/svn/extensions/part_assets

This extension requires that you’re running on the mental branch, and
that you also have my admin_parts extension installed:

http://dev.radiantcms.org/svn/radiant/branches/mental/
http://soxbox.no-ip.org/radiant/svn/extensions/admin_parts

Features of this extension:

  • Images are linked to each page, rather than being global.

    Local images can be displayed with:

      <r:image name="monkey.jpg"/>
    

    Images from another page with:
    <r:find url="/some/page/name>
    <r:image name=“monkey.jpg”/>
    </r:find>

  • 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
    images:

    #app/views/assets/polariod.flexi

    @image.resize! :size => ‘100x100’
    @image.border! :size => 3
    @image.shadow!

    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
yet.
- 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.

Dan.


#2

Oh, and if you play with this, be aware that I reserve the right to
completely change it in an incompatable manner (I’m thinking in
particular of the way in which the assets are stored on the filesystem).


#3

Great stuff Daniel, looking forward to playing more with the
FlexImage stuff after the new year. Hadn’t heard of it before, looks
pretty cool!

In the meantime the only thing that jumped out at me were some
missing icons :wink: Attached some BeOS icons I used in case said icons
don’t really exist yet (they’re in png, not jpg)

-jamie


#4

nice work bud, i am playing with it now, i might help out with some of
it in a week or two when im done trying to implement it.


#5

I’ve progressed on my asset management extension.

Further updates will be available at:

http://soxbox.no-ip.org/radiant

I’ve now finished:
- a way to upload asset for a page that hasn’t been created yet.

If you upload an asset and subsequently don't save the page,

it’s still
left orphaned though (probably just have a rake task to clean.

- Caching. Currently using the exact same mechanism as the rest

of radiant
(ie. 5 minute expiry and stored in yaml files). Not the best
approach for
either large assets or manipulated images.

So that leaves:

- a nice way to edit/delete images
- validation
- tests
- confidence that you can use this without screwing up your

data/life/mind.

Original announcement:

http://soxbox.no-ip.org/radiant/articles/2007/01/02/page-asset-managemen
t/