# \[RÉSOLU\]Quel hébergeur d'images ?

**URL:** <https://www.debian-fr.org/t/resolu-quel-hebergeur-dimages/9507>\
**Category:** Pause Café\
**Created:** [Février 20, 2016, 4:26 UTC](https://www.debian-fr.org/t/resolu-quel-hebergeur-dimages/9507 "2016-02-20T16:26:22Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![Ashgenesis](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/a/57b2e6/32.png) [@Ashgenesis](https://www.debian-fr.org/u/Ashgenesis)\
**Post date:** [Février 20, 2016, 4:28 UTC](https://www.debian-fr.org/t/resolu-quel-hebergeur-dimages/9507/21 "2016-02-20T16:28:23Z")

</div>

free utilise bien la librairie GD, tiens c’est cadeau mais pas vraiment très propre comme code.

[code]\<?php  
$array\_jpg=NULL;  
$dirpath="./";

function jpg2tab($array\_jpg, $path)  
{  
if (!is\_object($handle = dir($path)))  
{  
return false;  
}  
while($file = $handle -\> read())  
{  
if($file != “.” && $file != “…”){  
if(preg\_match("/.jpg/i", $file)){  
$array\_jpg[] = $file;  
}  
}  
}  
return $array\_jpg;  
}

function tab2png($tab, $path)  
{  
chdir($path);  
foreach($tab as $file)  
{  
$out = preg\_replace("/.jpg/i", “.png”, $file);  
if (!file\_exists($out)){  
$attr = getimagesize($file);  
$src = imagecreatefromjpeg($file);  
$dest = imagecreatetruecolor(200,150);  
imagecopyresampled($dest,$src,0,0,0,0,200,150,$attr[0],$attr[1]);  
imagepng($dest,$out, 2);  
}  
}  
}

function show\_png($tab, $path)  
{  
foreach($tab as $file)  
{  
$out = eregi\_replace(".jpg", “”, $file);  
echo “\<a href=”$path$out.jpg"\>\<img src="$path$out.png" border=“0”\>";  
}  
}  
?\>

 Galerie photo \<?php $array = jpg2tab($array\_jpg, $dirpath); $new = count($array); echo '
# Mes '.$new." photos
\n"; tab2png($array, $dirpath); show\_png($array, $dirpath); ?\> [/code]

[Page précédente](https://www.debian-fr.org/t/resolu-quel-hebergeur-dimages/9507.md?page=1)
