Problems with GD, Version Incompatibilities

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Konman

    #1

    Problems with GD, Version Incompatibilities

    I am new to php and have run into one problem with one of the scripts I have
    found and I am unsure of how to correct the problem.

    My Web Host is currently running PHP Version 4.1.2 and PHP Info returns the
    following information for the GD module.

    GD Support enabled
    GD Version 1.6.2 or higher
    FreeType Support enabled
    FreeType Linkage with freetype
    JPG Support enabled
    PNG Support enabled
    WBMP Support enabled


    The problem is the script I am using has functions used in it that were not
    available in this version of GD. Here is the code for the script.


    $src = imagecreatefrom jpeg("$image");
    $im = imagecreatetrue color($newwidth ,$newheight);
    imagecopyresamp led($im,$src,0, 0,0,0,$newwidth ,$newheight,$wi dth,$height);
    imagejpeg($im, '',85);
    imagedestroy($i m);

    From what I have been able to find out.

    The following two functions were not available until GD 2.0

    imagecreatetrue color
    imagecopyresamp led

    And imagejpeg Requires GD 1.8

    Any suggestions on how to rewrite this script to use the older GD 1.6.2?
    This code is used to create all of the thumb nails dynamically. I had the
    entire site ready to go online and tested on my home system running Apache
    and PHP 4.3.3 and once it was uploaded the gallery stopped working..

    Any help would be greatly appreciated.



  • s a n j a y

    #2
    Re: Problems with GD, Version Incompatibiliti es

    replace "imagecreatetru ecolor" with "imagecreat e" and
    "imagecopyresam pled" with "imagecopyresiz ed"

    that should work.

    sanjay



    "Konman" <konman_2k3@yah oo.com> wrote in message
    news:Xemib.6829 $x97.5961@clgrp s13...
    | I am new to php and have run into one problem with one of the scripts I
    have
    | found and I am unsure of how to correct the problem.
    |
    | My Web Host is currently running PHP Version 4.1.2 and PHP Info returns
    the
    | following information for the GD module.
    |
    | GD Support enabled
    | GD Version 1.6.2 or higher
    | FreeType Support enabled
    | FreeType Linkage with freetype
    | JPG Support enabled
    | PNG Support enabled
    | WBMP Support enabled
    |
    |
    | The problem is the script I am using has functions used in it that were
    not
    | available in this version of GD. Here is the code for the script.
    |
    |
    | $src = imagecreatefrom jpeg("$image");
    | $im = imagecreatetrue color($newwidth ,$newheight);
    | imagecopyresamp led($im,$src,0, 0,0,0,$newwidth ,$newheight,$wi dth,$height);
    | imagejpeg($im, '',85);
    | imagedestroy($i m);
    |
    | From what I have been able to find out.
    |
    | The following two functions were not available until GD 2.0
    |
    | imagecreatetrue color
    | imagecopyresamp led
    |
    | And imagejpeg Requires GD 1.8
    |
    | Any suggestions on how to rewrite this script to use the older GD 1.6.2?
    | This code is used to create all of the thumb nails dynamically. I had the
    | entire site ready to go online and tested on my home system running Apache
    | and PHP 4.3.3 and once it was uploaded the gallery stopped working..
    |
    | Any help would be greatly appreciated.
    |
    |
    |


    Comment

    • Paulus Magnus

      #3
      Re: Problems with GD, Version Incompatibiliti es

      "s a n j a y" <someone@somewh ere.com> wrote in message
      news:A%mib.1345 $8x2.585505@new ssrv26.news.pro digy.com...[color=blue]
      > "Konman" <konman_2k3@yah oo.com> wrote in message
      > news:Xemib.6829 $x97.5961@clgrp s13...
      > | I am new to php and have run into one problem with one of the scripts I
      > have
      > | found and I am unsure of how to correct the problem.
      > |
      > | My Web Host is currently running PHP Version 4.1.2 and PHP Info returns
      > the
      > | following information for the GD module.
      > |
      > | GD Support enabled
      > | GD Version 1.6.2 or higher
      > | FreeType Support enabled
      > | FreeType Linkage with freetype
      > | JPG Support enabled
      > | PNG Support enabled
      > | WBMP Support enabled
      > |
      > |
      > | The problem is the script I am using has functions used in it that were
      > not
      > | available in this version of GD. Here is the code for the script.
      > |
      > |
      > | $src = imagecreatefrom jpeg("$image");
      > | $im = imagecreatetrue color($newwidth ,$newheight);
      > |[/color]
      imagecopyresamp led($im,$src,0, 0,0,0,$newwidth ,$newheight,$wi dth,$height);[color=blue]
      > | imagejpeg($im, '',85);
      > | imagedestroy($i m);
      > |
      > | From what I have been able to find out.
      > |
      > | The following two functions were not available until GD 2.0
      > |
      > | imagecreatetrue color
      > | imagecopyresamp led
      > |
      > | And imagejpeg Requires GD 1.8
      > |
      > | Any suggestions on how to rewrite this script to use the older GD 1.6.2?
      > | This code is used to create all of the thumb nails dynamically. I had[/color]
      the[color=blue]
      > | entire site ready to go online and tested on my home system running[/color]
      Apache[color=blue]
      > | and PHP 4.3.3 and once it was uploaded the gallery stopped working..
      > |
      > | Any help would be greatly appreciated.
      >
      > replace "imagecreatetru ecolor" with "imagecreat e" and
      > "imagecopyresam pled" with "imagecopyresiz ed"
      >
      > that should work.
      >
      > sanjay[/color]

      However, you need to know that imagecreate and imagecreatetrue color are
      different and will only result in a 256 color, paletted image being created,
      even with a JPEG. Imagecopyresize d is also a non-aliased version of
      imagecopyresamp led and the thumbnails will therefore look very pixelated.
      There is a user contributed function on php.net that provides bicubic
      resampling and that generates an aliased version. The result is a lot better
      than imagecopyresize d but the processing load is intensive.

      If you're a quality freak; you may want to consider thumbnailing on your
      local computer instead or getting a different host as the whole PHP 4.1.2
      environment seems to indicate to me that the host is not keeping up to date
      and not providing a comparable service to others out there. There are a lot
      of very useful features in PHP 4.3.x and I personally find it very difficult
      to develop for pre-4.3.0 environments and don't usually even try.

      Paulus


      Comment

      • Konman

        #4
        Re: Problems with GD, Version Incompatibiliti es

        Thank You

        Works great.


        Konman

        "s a n j a y" <someone@somewh ere.com> wrote in message
        news:A%mib.1345 $8x2.585505@new ssrv26.news.pro digy.com...[color=blue]
        > replace "imagecreatetru ecolor" with "imagecreat e" and
        > "imagecopyresam pled" with "imagecopyresiz ed"
        >
        > that should work.
        >
        > sanjay
        >
        >
        >
        > "Konman" <konman_2k3@yah oo.com> wrote in message
        > news:Xemib.6829 $x97.5961@clgrp s13...
        > | I am new to php and have run into one problem with one of the scripts I
        > have
        > | found and I am unsure of how to correct the problem.
        > |
        > | My Web Host is currently running PHP Version 4.1.2 and PHP Info returns
        > the
        > | following information for the GD module.
        > |
        > | GD Support enabled
        > | GD Version 1.6.2 or higher
        > | FreeType Support enabled
        > | FreeType Linkage with freetype
        > | JPG Support enabled
        > | PNG Support enabled
        > | WBMP Support enabled
        > |
        > |
        > | The problem is the script I am using has functions used in it that were
        > not
        > | available in this version of GD. Here is the code for the script.
        > |
        > |
        > | $src = imagecreatefrom jpeg("$image");
        > | $im = imagecreatetrue color($newwidth ,$newheight);
        > |[/color]
        imagecopyresamp led($im,$src,0, 0,0,0,$newwidth ,$newheight,$wi dth,$height);[color=blue]
        > | imagejpeg($im, '',85);
        > | imagedestroy($i m);
        > |
        > | From what I have been able to find out.
        > |
        > | The following two functions were not available until GD 2.0
        > |
        > | imagecreatetrue color
        > | imagecopyresamp led
        > |
        > | And imagejpeg Requires GD 1.8
        > |
        > | Any suggestions on how to rewrite this script to use the older GD 1.6.2?
        > | This code is used to create all of the thumb nails dynamically. I had[/color]
        the[color=blue]
        > | entire site ready to go online and tested on my home system running[/color]
        Apache[color=blue]
        > | and PHP 4.3.3 and once it was uploaded the gallery stopped working..
        > |
        > | Any help would be greatly appreciated.
        > |
        > |
        > |
        >
        >[/color]


        Comment

        Working...