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 ?

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 17 2025 23:57:44
Script start
Timing: Jan 17 2025 23:57:44
Module start 'layout'
Timing: Jan 17 2025 23:57:44
Module start 'content'
Timing: Jan 17 2025 23:57:44
Module end 'content'
Timing: Jan 17 2025 23:57:44
Script end

Main resources:

Total runtime0.0135 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0043 589.0547152.6250
Module start 'layout' 0.00430.0023 741.679739.4531
Module start 'content' 0.00660.0048 781.132889.5078
Module end 'content' 0.01140.0020 870.640634.2891
Script end 0.0135  904.9297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002417.7706140.0002
Check MTime0.00118.2378140.0001
Mysql Total
Database connection0.00064.765510.0006
Mysqli_queries0.001813.246830.0006
Looping result0.00000.090010.0000
Template Total0.001712.510.0017
Template load0.00096.806910.0009
Template processing0.00085.683010.0008
Override
Cache load0.00074.897810.0007
General
dbfile0.00021.829680.0000
String conversion0.00000.058240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs