function CreateThumb($Image, $Source, $Destination, $Max, $ext) { $src = ""; if ($ext == "gif") { if (function_exists("imagecreatefromgif")) { $src = @imagecreatefromgif($Source . "/" . $Image); } } else { if (function_exists("imagecreatefromjpeg")) { $src = @imagecreatefromjpeg($Source . "/" . $Image); } } $size = imagesize($Source . "/" . $Image, $Max); $h_i = $size['hauteur'][0]; //hauteur $w_i = $size['largeur'][0]; //largeur if ($src) { if (function_exists("imagecreatetruecolor")) { $im = @imagecreatetruecolor($w_i, $h_i); } else { $im = @imagecreate($w_i, $h_i); } @imagecopyresized($im, $src, 0, 0, 0, 0, $w_i, $h_i, $size['largeur'][1], $size['hauteur'][1]); @imageinterlace($im, 1); if ($ext == "gif") { @imagegif($im, $Destination . $Image); } else { @imagejpeg($im, $Destination . $Image, 75); } @chmod($Dest . $Image, 0766); $size['gene-img'][0] = true; } return $size; }
<article class="ctbox"> <?php echo $content; ?> <?php $n = 1; if (is_array($pictures)) { foreach ($pictures as $r) { ?> <figure itemprop="associatedMedia"> <a href="<?php echo $r['url']; ?> " itemprop="contentUrl" data-size="<?php echo imagesize($r['url']); ?> "> <img src="<?php echo imagecut($r['url'], 630, 460, 2); ?> " itemprop="thumbnail" alt="<?php echo $r['alt']; ?> " /> </a> <div class="ext-info"> <figcaption itemprop="caption description"><?php echo $r['alt']; ?> </figcaption>