eZ Community » Forums » Developer » Image objects not found by...
expandshrink

Image objects not found by fetchByURLPath

Image objects not found by fetchByURLPath

Wednesday 26 January 2011 5:00:52 pm - 4 replies

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?

Wednesday 26 January 2011 6:03:19 pm

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

Thursday 27 January 2011 8:34:01 am

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?

Modified on Thursday 27 January 2011 8:34:36 am by Heiko Irrgang

Saturday 29 January 2011 9:33:12 am

Any devs around that can answer this one?

Thanks Robin

Monday 31 January 2011 7:54:27 am

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.

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from