Hi,

I've wrote simple script who makes from image thumbnail
Thereis source:

<?php
    Header("Content-type: image/jpeg");
    $path = implode($argv," ");
    $im_org = imageCreateFromJpeg($path);
    $y = ImageSY($im_org);
    $x = ImageSX($im_org);

    if ( $x >= $y ){
      $y = $y * 120 / $x;
      $x = 120;
    } else {
      $x = $x * 120 / $y;
      $y = 120;
    }

    $im_thumb = imagecreate (120, 120);

    $thumb_posX = round ((120 - $x)/2, 0);
    $thumb_posY = round ((120 - $y)/2, 0);

    ImageCopyResized ($im_thumb, $im_org, $thumb_posX, $thumb_posY, 0, 0,
$x, $y, ImageSX($im_org), ImageSY($im_org));
    ImageJpeg ($im_thumb);
    ImageDestroy ($im_org);
    ImageDestroy ($im_thumb);
?>


Probles is that when i use ImageCopyResampled or  ...Resized something wrong
with color pallete.

There is sample:

http://gsk.vtu.lt:8080/~azero/img/thumb.php?a001.jpg
Real picture is here:
http://gsk.vtu.lt:8080/~azero/img/a001.jpg

Is it my code problem or it's gd's bug ?




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to