Image objects not found by fetchByURLPath

Author Message

Heiko Irrgang

Wednesday 26 January 2011 8:00:52 am

Hi,

i am importing images into ezpublish and i want not to import images twice, so i want to check first if they are already there.

The images are saved in Media/Images/Imported and have names like myimage.jpg

If i just open the url http://mysite/Media/Images/Imported/myimage.jpg with the browser, the image is shown (in the layout though)

If i try to get the image with $obj=eZContentObjectTreeNode::fetchByURLPath('Media/Images/Imported/myimage.jpg') i get NULL

I also read here in the forum, that fetchByURLPath uses path_identification_string from table ezcontentobject_tree, i checked the database and it has values like

media/images/imported/myimage_jpg

... and i tried to use this string with fetchByURLPath, still getting NULL

How can i fetch image objects?

Robin Muilwijk

Wednesday 26 January 2011 9:03:19 am

Hi,

The function you refer to has recently been mentioned in an article, see http://share.ez.no/learn/ez-publish/creating-ez-publish-objects-in-php/(page)/5. It might help to check that out.

Regards, Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Heiko Irrgang

Wednesday 26 January 2011 11:34:01 pm

Yeah, thanx i read this article, it's good. Anyway, i had a error on a other place, doing a strtolower(str_replace(array('.','-'),'_',$url)); on the url does work, but i can not be sure if there are other chars that are replaced.

Is there a ezPublish API function that cleans up the url so it matches the values in path_identification_string?

Robin Muilwijk

Saturday 29 January 2011 12:33:12 am

Any devs around that can answer this one?

Thanks Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Maxime Thomas

Sunday 30 January 2011 10:54:27 pm

Have you tried to make it begin with a '/' ?

I'm not sure, but it's maybe an updateniceurls.php script related issue. Maybe you can look there.

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas

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 02:02:26
Script start
Timing: Jan 18 2025 02:02:26
Module start 'layout'
Timing: Jan 18 2025 02:02:26
Module start 'content'
Timing: Jan 18 2025 02:02:28
Module end 'content'
Timing: Jan 18 2025 02:02:28
Script end

Main resources:

Total runtime1.9884 sec
Peak memory usage4,096.0000 KB
Database Queries66

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0048 588.0469152.6406
Module start 'layout' 0.00480.0025 740.687539.4844
Module start 'content' 0.00731.9785 780.1719605.8203
Module end 'content' 1.98590.0024 1,385.992216.4375
Script end 1.9882  1,402.4297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.1659160.0002
Check MTime0.00130.0665160.0001
Mysql Total
Database connection0.00070.036110.0007
Mysqli_queries1.928897.0046660.0292
Looping result0.00060.0305640.0000
Template Total1.956298.420.9781
Template load0.00200.100820.0010
Template processing1.954298.282620.9771
Template load and register function0.00010.007010.0001
states
state_id_array0.00070.036410.0007
state_identifier_array0.00220.112820.0011
Override
Cache load0.00170.0845290.0001
Sytem overhead
Fetch class attribute can translate value0.00070.032830.0002
Fetch class attribute name0.00150.074270.0002
XML
Image XML parsing0.00150.076430.0005
class_abstraction
Instantiating content class attribute0.00000.000980.0000
General
dbfile0.00160.0794240.0001
String conversion0.00000.000340.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
5content/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
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs