Why dont you create a cache mechanism for medias?
Just like content has xml caching, then the same for medias.
As we know, GetMedia is calling database everytime and is resource consuming ehh....
It would me nice to have a library function to parse media nodes from an xml cache.
Think about it.
I would love this as well, and I think there is some conversation about it in the core team.
Until then, maybe you can make a docType with an upload field on it? Then you'd use the content tree instead of the media section (and content pickers instead of media pickers). Then the media would be cached and you wouldn't need to use GetMedia() with its database hit.
cheers,doug.
You can use Umbraco Examine to do it, which is just a Lucene.NET indexer but can index anything based on CMSNode which Media and Documents are
I've allready tried to create a cached mechanism with xml and some library functions with semi-success using media node events.
The problem is that medias has only create and delete events, and not move or sort events. That makes it insufficient.
So, any time I want to sort, or move a media node, I have to recreate the cache and xml manually.
I would love to have complete media node events as the content events.
Will Lefteris have his wish come true for the events for media and caching for media in 4.1?
There's a Media Cache package available - http://our.umbraco.org/projects/cultiv-mediacache
@slace - that is indeed a nice package. But it could be great to have caching as default in umbraco so you dont need to rewrite your xslt.
You don't need to write your own, Sebastiaan has done it for you :P
But it may or may not be coming in 4.1 (I like to be vague ;)).
Yes but Sebastiaan wont rewrite all my xslt that use GetMedia, or will he? :)