Announcement

Collapse
No announcement yet.

Imagecreatetruecolor (Thumbnail help!)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Imagecreatetruecolor (Thumbnail help!)

    Hi all!

    Since there are so many knowledgeable peope here, I thought I would ask for a little more help! My script creates thumbnails and most of the thumbnails appear pixelated. When I click on the thumbs to view the actual photo, the photo is normal.

    Here is my script that creates the thumbs:

    PHP Code:
    <?php
     
    require("config.php");
     
    require(
    "functions.php");
     
    function 
    createthumb($name,$new_w,$new_h){ 
     
    global 
    $gd2
     
    $system=explode(".",$name); 
     
    if (
    preg_match("/jpg|jpeg/",$system[1])){ 
     
    $src_img=imagecreatefromjpeg($name); 
     

     
    if (
    preg_match("/png/",$system[1])){ 
     
    $src_img=imagecreatefrompng($name); 
     

     
    $old_x=imageSX($src_img); 
     
    $old_y=imageSY($src_img); 
     
    if (
    $old_x $old_y) { 
     
    $thumb_w=$new_w
     
    $thumb_h=$old_y*($new_h/$old_x); 
     

     
    if (
    $old_x $old_y) { 
     
    $thumb_w=$old_x*($new_w/$old_y); 
     
    $thumb_h=$new_h
     

     
    if (
    $old_x == $old_y) { 
     
    $thumb_w=$new_w
     
    $thumb_h=$new_h
     

     
    if (
    $gd2==""){ 
     
    $dst_img=ImageCreate($thumb_w,$thumb_h); 
     
    imagecopyresized($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); 
     
    }else{ 
     
    $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); 
     
    imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); 
     

     
    if (
    preg_match("/png/",$system[1])){ 
     
    imagepng($dst_img); 
     
    } else { 
     
    imagejpeg($dst_img); 
     

     
    imagedestroy($dst_img); 
     
    imagedestroy($src_img); 
     

     
    //$gd2=checkgd(); 
     
    header("Content-type: image/png");
     
    createthumb($_GET['location'],$_GET['w'],$_GET['h']); 
     
    ?>
    Now here is one of the thumbs:

    http://nowratethis.com/thumb.php?loc...pg&w=100&h=100

    Though the photos was taken in a club, the photo should not have that orange tint to it, it's just pixelated! Can anyone make any reccomendations on what I should do to fix this? Thanks!!
    </FONT>
    http://www.icecreamforum.com
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X