Forums / Developer / Image objects not found by fetchByURLPath

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

eZ debug

Timing: Jan 17 2025 23:40:03
Script start
Timing: Jan 17 2025 23:40:03
Module start 'content'
Timing: Jan 17 2025 23:40:04
Module end 'content'
Timing: Jan 17 2025 23:40:04
Script end

Main resources:

Total runtime1.4739 sec
Peak memory usage4,096.0000 KB
Database Queries203

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0067 589.2734180.8203
Module start 'content' 0.00671.3246 770.0938610.9141
Module end 'content' 1.33130.1424 1,381.0078337.6797
Script end 1.4738  1,718.6875 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.2597210.0002
Check MTime0.00150.0986210.0001
Mysql Total
Database connection0.00060.043910.0006
Mysqli_queries1.399194.92552030.0069
Looping result0.00220.14622010.0000
Template Total1.434797.320.7174
Template load0.00200.135220.0010
Template processing1.432797.209620.7164
Template load and register function0.00020.011810.0002
states
state_id_array0.00190.127910.0019
state_identifier_array0.00130.089420.0007
Override
Cache load0.00170.1145290.0001
Sytem overhead
Fetch class attribute can translate value0.00120.082840.0003
Fetch class attribute name0.00150.102970.0002
XML
Image XML parsing0.00160.109240.0004
class_abstraction
Instantiating content class attribute0.00000.001180.0000
General
dbfile0.00320.2178350.0001
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs