Subversion Repositories eFlore/Applications.cel

Rev

Rev 2414 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2414 Rev 3459
Line 371... Line 371...
371
	public function obtenirImageEtInfosPourChemin($chemin_fichier) {
371
	public function obtenirImageEtInfosPourChemin($chemin_fichier) {
372
		$image_et_infos = false;
372
		$image_et_infos = false;
Line 373... Line 373...
373
 
373
 
374
		if (file_exists($chemin_fichier)) {
374
		if (file_exists($chemin_fichier)) {
375
			$image_et_infos = array();
375
			$image_et_infos = array();
376
			list($image_et_infos['largeur'], $image_et_infos['hauteur']) = getimagesize($chemin_fichier);
376
			list($image_et_infos['largeur'], $image_et_infos['hauteur'], $image_et_infos['imagetype']) = getimagesize($chemin_fichier);
377
			$image_et_infos['poids_octets'] = filesize($chemin_fichier);
-
 
378
			$image_et_infos['image'] = imagecreatefromjpeg($chemin_fichier);
377
			$image_et_infos['poids_octets'] = filesize($chemin_fichier);
-
 
378
			$image_et_infos['chemin'] = $chemin_fichier;
-
 
379
 
-
 
380
			switch (image_type_to_mime_type($image_et_infos['imagetype'])) {
-
 
381
				case 'image/jpeg':
-
 
382
					$image_et_infos['image'] = imagecreatefromjpeg($chemin_fichier);
-
 
383
					break;
-
 
384
				case 'image/png':
-
 
385
					$image_et_infos['image'] = imagecreatefrompng($chemin_fichier);
-
 
386
					break;
-
 
387
				default:
-
 
388
					// ni jpeg ni png donc pas supporté, ça dégage
-
 
389
					return false;
379
			$image_et_infos['chemin'] = $chemin_fichier;
390
			}
Line 380... Line 391...
380
		}
391
		}
381
 
392
 
Line 664... Line 675...
664
		$image_sortie = ImageCreateFromJpeg($out);
675
		$image_sortie = ImageCreateFromJpeg($out);
665
		unlink($out);
676
		unlink($out);
Line 666... Line 677...
666
 
677
 
667
		return $image_sortie;
678
		return $image_sortie;
668
	}
-
 
669
}
679
	}
-
 
680
}