eZ Community » Forums » Developer » image alias deleted after clearing cache

image alias deleted after clearing cache

image alias deleted after clearing cache

Monday 08 September 2008 9:51:10 am - 2 replies

hi all,

at the moment I'm facing a strange behaviour with the handling of image_alias.
I created a custom module which creates an xml-output in order to interact with flash. I created an image alias which is only needed by the flash.
The URL to the image ist created by following snippet:

        $object = $item->object();
        $dataMap = $object->dataMap();
        $image = $dataMap['image']->content();
        $aliasList = $image->aliasList();

To create the Images I build an temporary template which contains the image alias for the xml-output. At this point the module works fine and the path to the image will be displayed.

After clearing the cache the module displays no url. A var_dump of the $aliasList array displays only the original "image alias", even though the image alias exists in the var directory. Unless I call the temporary template only the original image alias is displayed.

I use ezpublish 4.0.1rc1 and according to this issue http://issues.ez.no/IssueView.php?Id=13191 this should be fixed or this is no bug? I'm not sure. So maybe someone has an idea.

Thanks in advance,

Monday 08 September 2008 10:05:55 am

We have suffered similar problems here with image alias, and were solved upgrading to the official 4.0.1.


Monday 08 September 2008 10:47:18 am

I'm not sure about the correct way to deal with image aliases in custom modules / extension.

I've read this article http://ez.no/doc/ez_publish/techn...eference/scripts/generic/ezcache_php and there is a image alias cache. Therefore I guess its correct that after clearing cache no aliases are available. But how to access the desired one?

The class eZImageAliasHandler has methods to check if a image alias exists and to get the full path to the desired image.

        $dataMap = $object->dataMap();

        $aliasHandler = new eZImageAliasHandler( $dataMap['image'] );
        $imgAlias = $aliasHandler->attribute( 'consultant_flash' );

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from