From: <ara...@us...> - 2008-08-23 16:44:33
|
Revision: 238 http://easybox-mod.svn.sourceforge.net/easybox-mod/?rev=238&view=rev Author: aragornis Date: 2008-08-23 16:44:30 +0000 (Sat, 23 Aug 2008) Log Message: ----------- Adaptation de l'API de transformation d'image au module de connexion au web (proxy) Modified Paths: -------------- trunk/http/_framework/lib/Photo.class.php trunk/http/_framework/lib/RemoteDL.class.php Modified: trunk/http/_framework/lib/Photo.class.php =================================================================== --- trunk/http/_framework/lib/Photo.class.php 2008-08-23 15:01:35 UTC (rev 237) +++ trunk/http/_framework/lib/Photo.class.php 2008-08-23 16:44:30 UTC (rev 238) @@ -1,8 +1,14 @@ <?php -$RACINE_REP = realpath('../../'); -define('CACHE_IMAGE', $RACINE_REP.'/_utilisateur/cache/'); +$RACINE_REP = '../../'; +define('CACHE_IMAGE', realpath($RACINE_REP).'/_utilisateur/cache/'); define('LIBRARIES_REP', $RACINE_REP.'/_framework/lib/'); +define('USER', $RACINE_REP.'_utilisateur/'); + +require_once(LIBRARIES_REP.'RemoteDL.class.php'); +require_once(LIBRARIES_REP.'Ini.class.php'); +$ini_class = new INI(USER.'configuration.ini'); + class image { // Adresse de l'image @@ -121,7 +127,9 @@ readfile($this->name_cache); // Sinon on charge l'image et on execute les demandes }else{ - if($data = file_get_contents($this->url)){ + $RemoteDL = new RemoteDL($this->url); + $RemoteDL->set_cache_time(0); + if($data = $RemoteDL->file_get_contents()){ $this->img = imagecreatefromstring($data); $this->width = imagesx($this->img); $this->height = imagesy($this->img); @@ -161,7 +169,7 @@ // Fonction d'erreur function error(){ - + echo 'erreur'; } // Fonction trouvant le bon argument entre 0 et 360 Modified: trunk/http/_framework/lib/RemoteDL.class.php =================================================================== --- trunk/http/_framework/lib/RemoteDL.class.php 2008-08-23 15:01:35 UTC (rev 237) +++ trunk/http/_framework/lib/RemoteDL.class.php 2008-08-23 16:44:30 UTC (rev 238) @@ -91,8 +91,10 @@ }else{ if($this->url_validate()){ $retour = file_get_contents($this->url,null,$this->get_context()); - file_put_contents(CACHE_IMAGE.$this->md5, $retour); - sqlite_query($db,'INSERT INTO cache VALUES(NULL,\''.sqlite_escape_string($this->md5).'\', \''.(time()+$this->cache_time).'\')'); + if($this->cache_time>0){ + file_put_contents(CACHE_IMAGE.$this->md5, $retour); + sqlite_query($db,'INSERT INTO cache VALUES(NULL,\''.sqlite_escape_string($this->md5).'\', \''.(time()+$this->cache_time).'\')'); + } }else{ return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |