functions of GD and netpbm

A

Anonymous

Guest
Hi all,

I have a script that uses the 'imagecreatefromjpeg()' although, I think this is a function of GD version 2.0 or higher. Myprovider does not have GD 2.0, (1.6 or 1.8 or something).

Is there an easy way to switch to netpbm instead?

Here is the script.



Code:
while ($currfile = readdir($handle))  
{
// Nous cherchons l'extention des fichier et gardons seulement les fichier images
   $extension= strtolower(substr( strrchr( $currfile,   "." ), 1 ));  
   if ($extension==  "gif" || $extension==  "jpg" || $extension==  "jpeg" ||
       $extension==  "png")
   {
      $nbfiles++;
      $currfile = trim($currfile);
      $fichier[$nbfiles] = $currfile;

      if ($ishome ==   "")
      {
         $size = GetImageSize($currfile);
         $width = $size[0] / $ratio;
         $height = $size[1] / $ratio;
          $format = $size[2];  //1 = GIF, 2 = JPG, 3 = PNG, 5 = PSD, 6 = BMP 

          $currthumbfile =  "./" . $dossier_thumb .  "/" . $préfix_thumb . $currfile;
          if (! file_exists($currthumbfile))
          {
             //format GIF format n'est plus supporter pa la librairie GD... 
            if ($format == 2)  //JPG 
                  $im = imagecreatefromjpeg($currfile);
            else if ($format == 3)  //PNG 
                  $im = imagecreatefrompng($currfile);
            if (!$im)
            {
               $currthumbfile = $currfile;
            }
            else
            {    
                   Imagejpeg($im, $currthumbfile, $qualité);
                   ImageDestroy($im);
            }
           }

         $currfile = str_replace( " ", "%20",$currfile);  // Pour que les noms avec espaces soient valides 
         $currthumbfile = str_replace( " ", "%20",$currthumbfile);  // Pour que les noms avec espaces soient valides 

         echo   "<A HREF=$scriptname?ishome=1&filename=$currfile&filenumber=$nbfiles>\n";
         echo   "<IMG SRC=$currthumbfile WIDTH=$width HEIGHT=$height";
         $currfile = str_replace( "%20", " ",$currfile);  // Pour que l'affichage des espaces soit "propre" 
         echo  " alt=\"L'originale de $currfile\">\n";
         $currfile = str_replace( " ", "%20",$currfile);     //pour que les noms avec espaces soient valides 
         echo   "</A>\n";
         $counter++;
         if ($counter == $columns)
         {
            $counter = 0;
            echo   "<P><P><BR>";
         }
      }
   }
}
closedir($handle);

Tahnks in advance,

NPereira
 
imagecreatefromjpeg is available in all builds of GD.

imagecreatefromgif is the one that was dropped back in build 1.6.4 or so.

Most hosts will upgrade shortly as GD2.0.4 is bundled with the distroes from 4.3 upward - a very useful module if you ask me :)
 
Well, howcome i'm getting this error:

Fatal error: Call to undefined function: imagecreatefromjpeg() in /usr/local/psa/home/vhosts/lesharfangsdegatineau.com/httpdocs/photo/photo.php on line 72

Thanks

NPereira
 
Back
Top