accessing derivatives

areisinger

Joined: 2008-01-21
Posts: 3
Posted: Mon, 2008-01-21 16:11

Hi all,
in fact i´m not sure where this really fits in, so admins: feel free to move this to a better fitting forum.

In my own php code i´m accessing Gallery2 through GalleryEmbed and GalleryCoreApi.
With calling GalleryCoreApi::createAlbum and GalleryCoreApi::addItemToAlbum i´m adding images to my gallery which works pretty well.

But later, when i´m trying to display them on my website, i go through the derivatives (GalleryCoreApi::fetchResizesByItemIds) and when i´m accessing the width Property it returns 0;
Only after i was accessing the resize through the Gallery2 WebInterface it works and seems to be created.

I tried to call rebuildDerivativeCacheIfNotCurrent already, which did not help.

What is the correct way, to ensure my resizes are created by code?
Or is there another correct way of accessing the resized items?

I hope someone can assist me in this...

tia,
alois

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2008-01-21 16:25

after calling rebuildDerivativeCacheIfNotCurrent(), do a list ($ret, $derivative) = $derivative->refresh() since your object is in memory and doesn't get updated automatically when some other method changes the underlying entity.

> What is the correct way, to ensure my resizes are created by code?

resizes get generated properly either way. to force it to generate it at some point, call rebuildDerivativeCacheIfNotCurrent().

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
areisinger

Joined: 2008-01-21
Posts: 3
Posted: Mon, 2008-01-21 22:55

perfect! works like a charm.
Thanks a lot for this!