1
Is there any other code on PHP
to crop an image from the bank MySQL
?
I’m using this, but it’s giving a problem with slider wow slider
Follows the code:
<?php
//<img src='thumb.php?end=uploads/...&largura=...&altura=...'>
$largura = $HTTP_GET_VARS['largura'];
$altura = $HTTP_GET_VARS['altura'];
$jpeg = $HTTP_GET_VARS['end'];
if($d=getimagesize($jpeg)){
if (!$largura or $largura==0) $largura = ($altura*$d[0])/$d[1];
if (!$altura or $altura==0) $altura = ($largura*$d[1])/$d[0];
$p_final = $largura/$altura;
$p_orig = $d[0]/$d[1];
if ($p_orig >= $p_final) {
$nova_largura = ($d[0]-(($largura*$d[1])/$altura))/2;
$x_i = $nova_largura;
$x_f = $d[0]-$nova_largura*2;
$y_i = 0;
$y_f = $d[1];
} else {
$x_i = 0;
$x_f = $d[0];
$nova_altura = ($d[1]-(($altura*$d[0])/$largura))/2;
$y_i = $nova_altura;
$y_f = $d[1]-$nova_altura*2;
}
header('Content-type: image/jpeg');
$src = imagecreatefromjpeg($jpeg);
$dst = ImageCreateTrueColor($largura, $altura);
$white = imagecolorallocate($dst,255,255,255);
imagefill($dst,0,0,$white);
imagecopyresampled($dst,$src,0,0,$x_i,$y_i,$largura,$altura,$x_f,$y_f);
imagejpeg($dst, null, 98);
imagedestroy($dst);
imagedestroy($src);
}
?>
Ghilherme Louro, thank you so much for the information, gave it right here!!! Thanks even!!!
– user3081