image alias deleted after clearing cache

Author Message

Marcus M.

Monday 08 September 2008 12:51:10 am

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();
        
        print($aliasList['consultant_flash']['full_path']);

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,
Marcus

Xavier Serna

Monday 08 September 2008 1:05:55 am

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

hth!

--
Xavier Serna
eZ Publish Certified Developer
Departament de Software
Microblau S.L. - http://www.microblau.net
+34 937 466 205

Marcus M.

Monday 08 September 2008 1: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/technical_manual/4_0/reference/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' );
        
        ezDebug::writeDebug($imgAlias['full_path']);

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 16:24:55
Script start
Timing: Jan 18 2025 16:24:55
Module start 'layout'
Timing: Jan 18 2025 16:24:55
Module start 'content'
Timing: Jan 18 2025 16:24:56
Module end 'content'
Timing: Jan 18 2025 16:24:56
Script end

Main resources:

Total runtime0.7993 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0077 588.0469152.6406
Module start 'layout' 0.00780.0030 740.687539.4766
Module start 'content' 0.01080.7870 780.1641547.9375
Module end 'content' 0.79780.0015 1,328.101612.1250
Script end 0.7992  1,340.2266 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.4199160.0002
Check MTime0.00130.1615160.0001
Mysql Total
Database connection0.00100.125510.0010
Mysqli_queries0.744193.0999570.0131
Looping result0.00050.0647550.0000
Template Total0.764395.620.3821
Template load0.00240.295020.0012
Template processing0.761995.326920.3810
Template load and register function0.00020.021110.0002
states
state_id_array0.00080.100010.0008
state_identifier_array0.00190.232220.0009
Override
Cache load0.00190.2366240.0001
Sytem overhead
Fetch class attribute can translate value0.00060.074220.0003
Fetch class attribute name0.00100.128450.0002
XML
Image XML parsing0.00280.348620.0014
class_abstraction
Instantiating content class attribute0.00000.001660.0000
General
dbfile0.00260.3193220.0001
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 18
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs