Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

functions of GD and netpbm

images php coding issues or problems here.

Moderators: macek, egami, gesf

functions of GD and netpbm

Postby npereira » Tue Mar 25, 2003 7:28 am

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: Select all
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
npereira
New php-forum User
New php-forum User
 
Posts: 10
Joined: Wed Jan 15, 2003 4:01 pm

Postby pootergeist » Tue Mar 25, 2003 8:22 am

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 :)
pootergeist
New php-forum User
New php-forum User
 
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK

Postby npereira » Tue Mar 25, 2003 8:25 am

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
npereira
New php-forum User
New php-forum User
 
Posts: 10
Joined: Wed Jan 15, 2003 4:01 pm


Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 0 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron