Hi
I am having a problem with creating images on my site. The png are created with a bad quality than the original. I use the code above to generate them. Is there a way to adjust the output quality?
<?php
$imagesources = $_POST[imagessourcesform];
if ($imagesources != '') {
$trimdomain = parse_url($yourdomain);
$trimdomain = $trimdomain[host];
$subdomain = explode(".", $trimdomain);
if ($subdomain[0] == 'www') $trimdomain = substr_replace($trimdomain, '', 0, 4);
$imagesources = explode(',', $imagesources);
$pxtall = $_POST[imagestallform];
$pxtall = explode(',', $pxtall);
$pxwide = $_POST[imageswideform];
$pxwide = explode(',', $pxwide);
$pxtop = $_POST[imagestopform];
$pxtop = explode(',', $pxtop);
$pxleft = $_POST[imagesleftform];
$pxleft = explode(',', $pxleft);
$n = 0;
$im = imagecreatetruecolor(200, 240);
foreach ($imagesources as $sources) {
$source = $imagesources[$n];
$source = str_replace($yourdomain, $serverpath, $source);
$source = str_replace('http://'.$trimdomain.'/', $serverpath, $source);
$pos = strpos($source, '../');
if($pos !== false) {
imagedestroy($im);
exit();
}
$pos = strpos($source, '..\\');
if($pos !== false) {
imagedestroy($im);
exit();
}
$height = $pxtall[$n];
$width = $pxwide[$n];
$top = $pxtop[$n];
$left = $pxleft[$n];
$prop = imagecreatefrompng($source);
imagecopy($im, $prop, $left, $top, 0, 0, $width, $height);
imagedestroy($prop);
$prop = '';
$n++;
}
$filename = 'minhacamisa.png';
header("Content-type: image/png");
header("Content-Disposition: attachment; filename=$filename");
imagejpeg($im);
imagejpeg($im,$filename);
}
?>
thanks!!!!