Forums / Developer / Sqliimport : Import images from an URL ?

Sqliimport : Import images from an URL ?

Author Message

Solène Guillot

Monday 22 August 2011 2:59:45 am

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

Hamdi Laadhari

Tuesday 23 August 2011 1:37:14 am

it's based on the ezpublish API. And the ezpublish API rely on fopen/fread. So the answer should be yes,

Certified eZ Publish Entreprise 4.5
http://www.laadhari.fr

Solène Guillot

Thursday 25 August 2011 8:49:49 am

Ok...

An idea how I can do it ?