Loading functions.php +14 −0 Original line number Diff line number Diff line Loading @@ -274,3 +274,17 @@ function numerique($nom, array $nombreChiffre, array $nombre) { return $nom; } /** * version unicode de pathinfo * @param string $filepath chemin * @return $tableau d'infos */ function mb_pathinfo($filepath) { preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im',$filepath,$m); if($m[1]) $r['dirname'] = $m[1]; if($m[2]) $r['basename'] = $m[2]; if($m[5]) $r['extension'] = $m[5]; if($m[3]) $r['filename'] = $m[3]; return $r; } No newline at end of file image.php +24 −15 Original line number Diff line number Diff line Loading @@ -69,12 +69,13 @@ class Image { $this->nom = $nom; $info = getimagesize((!empty($dossier) ? $dossier.DIRECTORY_SEPARATOR : '').$nom); $this->width_source = $this->width_cible = $info[0]; $this->height_source = $this->height_cible = $info[1]; $this->type = $this->types[$info[2]]; $this->mime = $info['mime']; $info = pathinfo((!empty($dossier) ? $dossier.DIRECTORY_SEPARATOR : '').$nom); $info = mb_pathinfo((!empty($dossier) ? $dossier.DIRECTORY_SEPARATOR : '').$nom); $this->dir_source = $this->dir_cible = $info['dirname']; $this->nom_base_source = $this->nom_base_cible = $info['filename']; $this->nom_ext_source = $this->nom_ext_cible = $info['extension']; Loading Loading @@ -225,7 +226,7 @@ class Image { } public function sauver () { $this->generer($this->adresse_finale()); return $this->generer($this->adresse_finale()); } private function adresse_finale() { Loading @@ -239,11 +240,13 @@ class Image { private function generer($nom) { $image = null; $cible = $this->dir_source.DIRECTORY_SEPARATOR.$this->nom_base_source.'.'.$this->nom_ext_source; switch ($this->mime) { case 'image/jpeg' : case 'image/pjpeg': $image = imagecreatefromjpeg($this->dir_source.DIRECTORY_SEPARATOR.$this->nom_base_source.'.'.$this->nom_ext_source); break; case 'image/png' : $image = imagecreatefrompng ($this->dir_source.DIRECTORY_SEPARATOR.$this->nom_base_source.'.'.$this->nom_ext_source); break; case 'image/gif' : $image = imagecreatefromgif ($this->dir_source.DIRECTORY_SEPARATOR.$this->nom_base_source.'.'.$this->nom_ext_source); break; case 'image/pjpeg': $image = imagecreatefromjpeg($cible); break; case 'image/png' : $image = imagecreatefrompng ($cible); break; case 'image/gif' : $image = imagecreatefromgif ($cible); break; } if($image != null) { Loading Loading @@ -288,6 +291,7 @@ class Image { if ($dim_width > 0 && $dim_height > 0) { $dest = imagecreatetruecolor($dim_width, $dim_height); //imageinterlace ($dest); if ($this->width_cible != $this->height_cible || $this->width_source != $this->height_source || ($this->width_decoupe > 0 && $this->height_decoupe > 0)) { // redimensionner Loading @@ -300,6 +304,7 @@ class Image { ); } try { switch (strtolower($this->nom_ext_cible)) { case 'jpeg' : case 'jpg' : imagejpeg($dest, $nom, $this->qualite); break; Loading @@ -308,7 +313,11 @@ class Image { } imagedestroy($image); imagedestroy($dest); return true; } catch (Exception $e) { return false; } return is_file($cible); } else { return false; } Loading index.php +5 −2 Original line number Diff line number Diff line Loading @@ -7,9 +7,12 @@ Licence : voir Licence.txt ######################################################################################################## */ ini_set('memory_limit', '256M'); ini_set('memory_limit', '512M'); ini_set('magic_quotes_gpc', 0); ini_set('max_execution_time', 6000); ini_set('max_execution_time', 10000); ini_set('display_errors',1); error_reporting(E_ALL); date_default_timezone_set('Europe/Paris'); /** ********************************************************************************************************************** / * retroune le temps en microseconde Loading procedure.php +8 −3 Original line number Diff line number Diff line Loading @@ -345,7 +345,8 @@ else { // sauvegarde de l'image finale $info = pathinfo($cache[$key]['chemin']); $info = mb_pathinfo($cache[$key]['chemin']); $img = new Image ($info['filename'].'.'.$info['extension'], $info['dirname']); $img->dir_cible(_DIR_RENDU); Loading Loading @@ -381,7 +382,9 @@ else { $img->ext_cible($format_img); $img->nom_cible($nom_format); $img->sauver(); if (!$img->sauver()) { break; } } $stats_info[$i]['grande'][1] = get_microtime(); Loading Loading @@ -409,7 +412,9 @@ else { if ($miniature_format == '') $miniature_format = $format_img; $img->ext_cible($miniature_format); $img->sauver(); if (!$img->sauver()) { break; } $stats_info[$i]['mini'][1] = get_microtime(); } Loading Loading
functions.php +14 −0 Original line number Diff line number Diff line Loading @@ -274,3 +274,17 @@ function numerique($nom, array $nombreChiffre, array $nombre) { return $nom; } /** * version unicode de pathinfo * @param string $filepath chemin * @return $tableau d'infos */ function mb_pathinfo($filepath) { preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im',$filepath,$m); if($m[1]) $r['dirname'] = $m[1]; if($m[2]) $r['basename'] = $m[2]; if($m[5]) $r['extension'] = $m[5]; if($m[3]) $r['filename'] = $m[3]; return $r; } No newline at end of file
image.php +24 −15 Original line number Diff line number Diff line Loading @@ -69,12 +69,13 @@ class Image { $this->nom = $nom; $info = getimagesize((!empty($dossier) ? $dossier.DIRECTORY_SEPARATOR : '').$nom); $this->width_source = $this->width_cible = $info[0]; $this->height_source = $this->height_cible = $info[1]; $this->type = $this->types[$info[2]]; $this->mime = $info['mime']; $info = pathinfo((!empty($dossier) ? $dossier.DIRECTORY_SEPARATOR : '').$nom); $info = mb_pathinfo((!empty($dossier) ? $dossier.DIRECTORY_SEPARATOR : '').$nom); $this->dir_source = $this->dir_cible = $info['dirname']; $this->nom_base_source = $this->nom_base_cible = $info['filename']; $this->nom_ext_source = $this->nom_ext_cible = $info['extension']; Loading Loading @@ -225,7 +226,7 @@ class Image { } public function sauver () { $this->generer($this->adresse_finale()); return $this->generer($this->adresse_finale()); } private function adresse_finale() { Loading @@ -239,11 +240,13 @@ class Image { private function generer($nom) { $image = null; $cible = $this->dir_source.DIRECTORY_SEPARATOR.$this->nom_base_source.'.'.$this->nom_ext_source; switch ($this->mime) { case 'image/jpeg' : case 'image/pjpeg': $image = imagecreatefromjpeg($this->dir_source.DIRECTORY_SEPARATOR.$this->nom_base_source.'.'.$this->nom_ext_source); break; case 'image/png' : $image = imagecreatefrompng ($this->dir_source.DIRECTORY_SEPARATOR.$this->nom_base_source.'.'.$this->nom_ext_source); break; case 'image/gif' : $image = imagecreatefromgif ($this->dir_source.DIRECTORY_SEPARATOR.$this->nom_base_source.'.'.$this->nom_ext_source); break; case 'image/pjpeg': $image = imagecreatefromjpeg($cible); break; case 'image/png' : $image = imagecreatefrompng ($cible); break; case 'image/gif' : $image = imagecreatefromgif ($cible); break; } if($image != null) { Loading Loading @@ -288,6 +291,7 @@ class Image { if ($dim_width > 0 && $dim_height > 0) { $dest = imagecreatetruecolor($dim_width, $dim_height); //imageinterlace ($dest); if ($this->width_cible != $this->height_cible || $this->width_source != $this->height_source || ($this->width_decoupe > 0 && $this->height_decoupe > 0)) { // redimensionner Loading @@ -300,6 +304,7 @@ class Image { ); } try { switch (strtolower($this->nom_ext_cible)) { case 'jpeg' : case 'jpg' : imagejpeg($dest, $nom, $this->qualite); break; Loading @@ -308,7 +313,11 @@ class Image { } imagedestroy($image); imagedestroy($dest); return true; } catch (Exception $e) { return false; } return is_file($cible); } else { return false; } Loading
index.php +5 −2 Original line number Diff line number Diff line Loading @@ -7,9 +7,12 @@ Licence : voir Licence.txt ######################################################################################################## */ ini_set('memory_limit', '256M'); ini_set('memory_limit', '512M'); ini_set('magic_quotes_gpc', 0); ini_set('max_execution_time', 6000); ini_set('max_execution_time', 10000); ini_set('display_errors',1); error_reporting(E_ALL); date_default_timezone_set('Europe/Paris'); /** ********************************************************************************************************************** / * retroune le temps en microseconde Loading
procedure.php +8 −3 Original line number Diff line number Diff line Loading @@ -345,7 +345,8 @@ else { // sauvegarde de l'image finale $info = pathinfo($cache[$key]['chemin']); $info = mb_pathinfo($cache[$key]['chemin']); $img = new Image ($info['filename'].'.'.$info['extension'], $info['dirname']); $img->dir_cible(_DIR_RENDU); Loading Loading @@ -381,7 +382,9 @@ else { $img->ext_cible($format_img); $img->nom_cible($nom_format); $img->sauver(); if (!$img->sauver()) { break; } } $stats_info[$i]['grande'][1] = get_microtime(); Loading Loading @@ -409,7 +412,9 @@ else { if ($miniature_format == '') $miniature_format = $format_img; $img->ext_cible($miniature_format); $img->sauver(); if (!$img->sauver()) { break; } $stats_info[$i]['mini'][1] = get_microtime(); } Loading