Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Bricolage: users

thumbnails on the fly

 

 

Bricolage users RSS feed   Index | Next | Previous | View Threaded


zdravko.balorda at siix

May 6, 2011, 5:38 AM

Post #1 of 9 (838 views)
Permalink
thumbnails on the fly

Hi,

I really need to switch to thumbnails. however I'll need several
thumbnails of different sizes. And I wish to avoid having many
documents of the same image unless they could be somehow be separated
from originals. So that they won't appear together in search results.

Since I don't know how to separate them, I was thinking about
creating thumbnails on the fly. A cover story template would do resizing
and cropping, and publishing the result, without ever storing a media.

Is this feasible?

Regards, Zdravko.


david at kineticode

May 6, 2011, 9:10 AM

Post #2 of 9 (793 views)
Permalink
Re: thumbnails on the fly [In reply to]

On May 6, 2011, at 5:38 AM, Zdravko Balorda wrote:

> I really need to switch to thumbnails. however I'll need several
> thumbnails of different sizes. And I wish to avoid having many
> documents of the same image unless they could be somehow be separated
> from originals. So that they won't appear together in search results.
>
> Since I don't know how to separate them, I was thinking about
> creating thumbnails on the fly. A cover story template would do resizing
> and cropping, and publishing the result, without ever storing a media.
>
> Is this feasible?

No. Media have to be stored in the database in order to be published. Unless your template is going to replicate distribution, which I wouldn't recommend.

You can prevent thumbnails from showing up in search results if you make them of a type or in a category that your users don't have permission to see. If you're happy with that, then do check out find_or_create_alternate() in the Image class:

http://www.bricolagecms.org/docs/current/api/Bric::Biz::Asset::Business::Media::Image#Public-Instance-Methods

Best,

David


david at kineticode

May 6, 2011, 9:10 AM

Post #3 of 9 (793 views)
Permalink
Re: thumbnails on the fly [In reply to]

On May 6, 2011, at 5:38 AM, Zdravko Balorda wrote:

> I really need to switch to thumbnails. however I'll need several
> thumbnails of different sizes. And I wish to avoid having many
> documents of the same image unless they could be somehow be separated
> from originals. So that they won't appear together in search results.
>
> Since I don't know how to separate them, I was thinking about
> creating thumbnails on the fly. A cover story template would do resizing
> and cropping, and publishing the result, without ever storing a media.
>
> Is this feasible?

No. Media have to be stored in the database in order to be published. Unless your template is going to replicate distribution, which I wouldn't recommend.

You can prevent thumbnails from showing up in search results if you make them of a type or in a category that your users don't have permission to see. If you're happy with that, then do check out find_or_create_alternate() in the Image class:

http://www.bricolagecms.org/docs/current/api/Bric::Biz::Asset::Business::Media::Image#Public-Instance-Methods

Best,

David


zdravko.balorda at siix

May 9, 2011, 12:24 AM

Post #4 of 9 (789 views)
Permalink
Re: thumbnails on the fly [In reply to]

David E. Wheeler wrote:
> On May 6, 2011, at 5:38 AM, Zdravko Balorda wrote:
>
>> I really need to switch to thumbnails. however I'll need several
>> thumbnails of different sizes. And I wish to avoid having many
>> documents of the same image unless they could be somehow be separated
>> from originals. So that they won't appear together in search results.
>>
>> Since I don't know how to separate them, I was thinking about
>> creating thumbnails on the fly. A cover story template would do resizing
>> and cropping, and publishing the result, without ever storing a media.
>>
>> Is this feasible?
>
> No. Media have to be stored in the database in order to be published. Unless your template is going to replicate distribution, which I wouldn't recommend.
>

Nor would I do that. :)

> You can prevent thumbnails from showing up in search results if you make them of a type or in a category that your users don't have permission to see.

This seems alright.

> If you're happy with that, then do check out find_or_create_alternate() in the Image class:
>
> http://www.bricolagecms.org/docs/current/api/Bric::Biz::Asset::Business::Media::Image#Public-Instance-Methods
>

Thanks.
One more thing, though: does this API allows for more than one thumbnail?
How to keep up with changes of the original media document? I saw somewhere, it's been
solved, but can't find it.

Zdravko


david at kineticode

May 9, 2011, 9:10 AM

Post #5 of 9 (790 views)
Permalink
Re: thumbnails on the fly [In reply to]

On May 9, 2011, at 12:24 AM, Zdravko Balorda wrote:

> Thanks.
> One more thing, though: does this API allows for more than one thumbnail?

Yes, just specify a different file_prefix or file_suffix for each.

> How to keep up with changes of the original media document? I saw somewhere, it's been
> solved, but can't find it.

It does not track changes in the original media document. Your template could sniff at the original and the thumbnail, though, and decide if it needs to be regenerated. Maybe the mtime on the files?

Best,

David


zdravko.balorda at siix

May 22, 2011, 11:37 PM

Post #6 of 9 (756 views)
Permalink
Re: thumbnails on the fly [In reply to]

>> You can prevent thumbnails from showing up in search results if you
>> make them of a type or in a category that your users don't have
>> permission to see.
>
> This seems alright.
>

It just has hit me: would a user be able to publish thumbnails in this case?

Zdravko


david at kineticode

May 23, 2011, 10:04 AM

Post #7 of 9 (754 views)
Permalink
Re: thumbnails on the fly [In reply to]

On May 22, 2011, at 11:37 PM, Zdravko Balorda wrote:

>>> You can prevent thumbnails from showing up in search results if you make them of a type or in a category that your users don't have permission to see.
>> This seems alright.
>
> It just has hit me: would a user be able to publish thumbnails in this case?

Yes, if they're related, IIRC. TIAS.

Best,

David


zdravko.balorda at siix

May 23, 2011, 10:49 PM

Post #8 of 9 (752 views)
Permalink
Re: thumbnails on the fly [In reply to]

David E. Wheeler wrote:
> On May 22, 2011, at 11:37 PM, Zdravko Balorda wrote:
>
>>>> You can prevent thumbnails from showing up in search results if you make them of a type or in a category that your users don't have permission to see.
>>> This seems alright.
>> It just has hit me: would a user be able to publish thumbnails in this case?
>
> Yes, if they're related, IIRC. TIAS.
>

Still, template will need to create media of a type for which a user will not
have even a READ privilege?!

There is a great thing about Bricolage being static: thumbnails can be created
by templates, and need not to be created in advance, typically before one even
knows the size of the thumbnail. Drupal can eat itself. :)

Regards, Zdravko


david at kineticode

May 24, 2011, 4:14 PM

Post #9 of 9 (753 views)
Permalink
Re: thumbnails on the fly [In reply to]

On May 23, 2011, at 10:49 PM, Zdravko Balorda wrote:

> Still, template will need to create media of a type for which a user will not
> have even a READ privilege?!

Templates don't check permissions, so you're fine there.

> There is a great thing about Bricolage being static: thumbnails can be created
> by templates, and need not to be created in advance, typically before one even
> knows the size of the thumbnail. Drupal can eat itself. :)

Yep.

Best,

David

Bricolage users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.