Monday 22 August 2011 11:59:45 am - 8 replies
Hi,
I would like to import images from another server. I have an URL to do this but it doesn't work. For the moment, I copy the images on my server and I give the local path to my script.
$contentOptionsImage = new SQLIContentOptions( array( 'class_identifier' => 'image', 'remote_id' => md5($pathtoimage) ) ); $contentImage = SQLIContent::create( $contentOptionsImage ); $contentImage->addLocation( $folderLocation ); $contentImage->fields->name = $row->title; $contentImage->fields->image = "/data/http/my_site/extension/sqliimport/".$pathtoimage; $publisher = SQLIContentPublisher::getInstance(); $publisher->publish( $contentImage ); unset( $contentImage );
Is it possible to give an URL like this :
$contentImage->fields->image = "http://www.anothersite.com/".$pathtoimage;
???
Thank you
Thursday 07 June 2012 3:43:06 pm
Hello,
i have a similaire issue and i hope that someone coulde help !
juste like in the example i have an image attribute to import to a content object but the images are from an other server with links like (http://myserver/myfolder/myimg...)
The bug is the ezImageAliasHandler user by default the initializeFromFile methode , and not the initializeFromHTTPFile wiche could probably work, (as seen on the error.log file)
I'd like to know if there is a way to configure the name of method to call manually , or any other possibles solutions !
Thank's
Friday 08 June 2012 1:40:07 pm
Hi Hicham,
The first solution is to contribute to http://projects.ez.no/sqliimport/subversion and add the possibility to have initializeFromHTTPFile used instead of the standard initializeFromFile.
The quicker alternative is to make sure, in your import script, to repatriate the image files locally first (on the machine where your import script is running), and then rely on the standard SQLiimport methods.
Cheers,
Friday 08 June 2012 2:36:20 pm
Hello !
in fact the seconde solution was the way i folowed and it works now !
But before i've tried several things like rewiriting the ezimage datatype but it seams that the ezimage datatype doesn't exist anymore (am under the eZ Publish Community Project 2012.2 , 4.6) , it was eventually replaced by the ezimagetype and i juste couldn't make it !
so i juste did it the easy way
!
I'll be on it after work today ! and if i do it somehow i'll share it down here and on the github repo !
Thank's !
Monday 11 June 2012 11:45:12 am
Hi Hicham,
Good to see it worked out just fine ![]()
Small thing : the so-called ezimage datatype was not removed: the datatypes' base files are always called <datatype-name>type.php. In your case, the dedicated PHP file is ezimagetype.php, that has always been around : https://github.com/ezsystems/ezpu...ter/kernel/classes/datatypes/ezimage
Cheers !
You must be logged in to post messages in this topic!