Archive for 'gestione immagini'


Manipolazioni delle immagini in PHP

Posted on 01. Sep, 2009 by daniele.

0

SCALA GRIGI

 
//to black and white
if(!file_exists('dw-bw.png')) {
	$img = imagecreatefrompng('dw-manipulate-me.png');
	imagefilter($img,IMG_FILTER_GRAYSCALE);
	imagepng($img,'db-bw.png');
	imagedestroy($img);
}
 

NEGATIVO

 
//to negative
if(!file_exists('dw-negative.png')) {
	$img = imagecreatefrompng('dw-manipulate-me.png');
	imagefilter($img,IMG_FILTER_NEGATE);
	imagepng($img,'db-negative.png');
	imagedestroy($img);
}
 

COLOR SEPPIA

 
//to black and white
if(!file_exists('dw-sepia.png')) {
	$img = imagecreatefrompng('dw-manipulate-me.png');
	imagefilter($img,IMG_FILTER_GRAYSCALE);
	imagefilter($img,IMG_FILTER_COLORIZE,100,50,0);
	imagepng($img,'db-sepia.png');
	imagedestroy($img);
}
 

Continue Reading

Un facilissimo Resize delle immagini al volo!

Posted on 26. Jul, 2009 by daniele.

0

< ?php
 
$imageSrc = (string)$_GET['image'];
 
$width = $_GET['width'];
 
if (is_numeric($width) && isset($imageSrc)){
 
header('Content-type: image/jpeg');
 
makeThumb($imageSrc, $width);
 
}
 
function makeThumb($src,$newWidth) {
 
$srcImage = imagecreatefromjpeg($src);
 
$width = imagesx($srcImage);
 
$height = imagesy($srcImage);
 
$newHeight = floor($height*($newWidth/$width));
 
$newImage = imagecreatetruecolor($newWidth,$newHeight);
 
imagecopyresized($newImage,$srcImage,0,0,0,0,$newWidth,$newHeight,$width,$height);
 
imagejpeg($newImage);
 
}
 
?>
 

Utilizzo:

<img src=”thumbnail.php?image=thumbnail.jpg&width=100” />

Continue Reading

Script php per creare immagini thumbnail

Posted on 03. Jan, 2009 by Administrator.

0

function create_img_gd($imgfile, $imgthumb, $newwidth) {
if (function_exists("imagecreate")) {
$imginfo = getimagesize($imgfile);
switch($imginfo[2]) {
case 1:
$type = IMG_GIF;
break;
case 2:
$type = IMG_JPG;
break;
case 3:
$type = IMG_PNG;
break;
case 4:
$type = IMG_WBMP;
break;
default:
return $imgfile;
break;
}
switch($type) {
case IMG_GIF:
if (!function_exists("imagecreatefromgif")) return $imgfile;
$srcImage = imagecreatefromgif("$imgfile");
break;
case IMG_JPG:
if (!function_exists("imagecreatefromjpeg")) return $imgfile;
$srcImage = imagecreatefromjpeg($imgfile);
break;
case IMG_PNG:
if(!function_exists("imagecreatefrompng")) return $imgfile;
$srcImage = imagecreatefrompng("$imgfile");
break;
case IMG_WBMP:
if (!function_exists("imagecreatefromwbmp")) return $imgfile;
$srcImage = imagecreatefromwbmp("$imgfile");
break;
default:
return $imgfile;
}
if ($srcImage){
$srcWidth = $imginfo[0];
$srcHeight = $imginfo[1];
$ratioWidth = $srcWidth / $newwidth;
$destWidth = $newwidth;
$destHeight = $srcHeight / $ratioWidth;
$destImage = imagecreatetruecolor($destWidth, $destHeight);
imagealphablending($destImage, true);
imagealphablending($srcImage, false);
imagecopyresized($destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight);
switch($type) {
case IMG_GIF:
imagegif($destImage, "$imgthumb");
break;
case IMG_JPG:
imagejpeg($destImage, "$imgthumb");
break;
case IMG_PNG:
imagepng($destImage, "$imgthumb");
break;
case IMG_WBMP:
imagewbmp($destImage, "$imgthumb");
break;
}
imagedestroy($srcImage);
imagedestroy($destImage);
return $imgthumb;
} else {
return $imgfile;
}
} else {
return $imgfile;
}
}

Continue Reading

Ridurre la dimensione delle immagini con smart image resizer

Posted on 09. Mar, 2008 by Administrator.

0

 

 smart image resizer è uno script php che ti permette di ridurre al volo la dimensione delle immagini jpg.

Sito web: http://shiftingpixel.com/2008/03/03/smart-image-resizer/

Continue Reading

aPop – AJAX Image Gallery

Posted on 24. Nov, 2007 by Administrator.

0

 

aPop è uno script per la gestione di una galleria di immagini in AJAX, PHP e MYSQL

Sito web: http://www.maxkiesler.com/apop/

Continue Reading