[CPS-devel] Imagegallery

Georges Racinet gracinet at nuxeo.com
Tue Apr 17 17:15:44 CEST 2007


On Apr 17, 2007, at 2:24 PM, Michael Schulz wrote:

> Hi,
>
> comments inline ...

same !

>
>> > At the moment, this type holds the original image and calculates a
>> > thumbnail, additionally it stores the thumbnail size in a int  
>> Field.
>> >
>> > I'd like to be able to change the thumbnail size field value and  
>> then
>> > re-thumbnail the original image. At the moment, since the original
>> > image data is not changed, it justs preserves both images.
>> >
>> > How could i achieve this?
>>
>> I have no clean solutions to offer currently. By coincidence, I've
>> been working lately on dependencies for
>> write process expressions (see https://svn.nuxeo.org/trac/pub/ticket/
>> 1830)
>> but computeDependantFields is another story; the computation is
>> actually done in DataModel, before the
>> write expressions are evaluated by storage adapters. Adding some
>> dependencies following there would have
>> unwanted side effects.
>
> I've taken a step back and changed the approach instead of using a new
> image field type that can manipulate dependant fields, I switched to
> using a new Integer field type, that holds the size value of the
> thumbnail to compute. Thereby i could overcome the problem that the
> resizing is triggered only when a new original image is uploaded, to a
> resizing thats triggered when the size is changed.

But won't you lose the update when size is unchanged while image is ?
Note that a widget in edit mode always updates the field it takes  
care of (with the notable exception of File related widgets, IIRC),
so changes made through the UI wouldn't be impacted by this.

>
>> > Maybe thios could be solved with a new action without  
>> customizing the
>> > document edit method.
>>
>> It's a matter of UI. I guess a new action could be clearer for the
>> user: they might better understand that the change is active.
>> If you have a new action, then you can avoid the workflow script,
>> hence the duplication.
>
> I'll try that way.
>
>> By the way, what you're implementing is generic and useful, so I'd
>> like to invite you to eventually include it in CPS for the 3.4.5
>> timeframe.
>> Requirements for that would be that:
>>         - it doesn't break if PIL is missing.
>>         - dependent fields and size field ids are configurable, so  
>> that it's
>> possible to resolve potential naming collisions.
>>
>> A unit test for the computeDependantFields would be a nice icing on
>> the cake, too ;-)
>
> Great, I'll send you the changes when finished, so you can have a
> look.

Ok, svn diff is the perfect format, there. I can cook a svn account,  
too.

> At the moment it's more a pragmatic approach, but in the future
> ...

No hurry, don't worry.

Cheers,

---------
Georges Racinet,   Nuxeo SAS
Open Source Enterprise Content Management (ECM)
Web: http://www.nuxeo.com/ and http://www.nuxeo.org/ - Tel: +33 1 40  
33 79 87






This list archive provided by Nuxeo, the leaders of open source ECM. Check out the Nuxeo 5 open source, standards-based ECM project.