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.