1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Rep Power
    I have a site hosted on a virtual server with php 3.0.15 and NO Image Magic.
    Trying to upload the jpg file and resize it on the server(unix, Apache).
    Code below:
    1.Successfully uploads
    2.Successfully echo's info about original image size
    3. DOES NOT resize
    4. Successfully renames image to the name according to the hidden tag from the previous form to make a reference to the MySql row id.
    What am I doing wrong with RESIZING?


    echo "New file name is $renamed_name<br>";

    $uploaddir = "uploads";

    $newfile = $uploaddir . "/$imgfile_name";
    echo "$newfile<br>";

    // move file to proper directory using the
    if (!copy($imgfile,$newfile)) {
    // if an error occurs the file could not
    // be written, read or possibly does not exist
    echo "Error Uploading File.";

    // delete temp file


    $imgsize = GetImageSize($newfile);

    print "Array element $imgsize[0] The width of the image: <b>". $imgsize[0] ."</b><br>";
    print "Array element $imgsize[1] The height of the image: <b>". $imgsize[1] ."</b><br>";

    print "Array element $imgsize[3] The width and height of the image in a ready to use format: <b>". $imgsize[3] ."</b><br>";

    if (($imgsize[0] > 250) &#0124; &#0124; ($imgsize[1] > 200)) {

    $newfile_t = $uploaddir . "/$imgfile_name_t";

    exec("$djpeg $newfile | $pnmscale -height 200 | $cjpeg -outfile $newfile_t");

    echo("<img src="uploads/$imgfile_name">");

    $int=rename($uploaddir . "/$imgfile_name",$uploaddir ."/$renamed_name.jpg");
    echo "New File path is $uploaddir/$renamed_name.jpgn";


  2. #2
  3. No Profile Picture
    Carpe Diem
    Devshed Newbie (0 - 499 posts)
    I think you need Image Magik for your code to work.

    We use the GD library and PHP. Works very well.

    http://www.php4hosting.com/ $
    http://www.php4hosting.co.uk/ £
    PHP/MySQL Enabled Hosting/Dedicated Servers, Reseller Accounts
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Rep Power
    I don't see $djpeg or $pnmscale or $cjpeg defined anywhere. But maybe this isn't the full script.

Similar Threads

  1. Convert Image GIF to JPG ??
    By daviddeveloper in forum PHP Development
    Replies: 2
    Last Post: February 15th, 2004, 10:45 PM
  2. Help with rescale jpg script
    By ksp in forum PHP Development
    Replies: 1
    Last Post: January 9th, 2004, 11:18 PM
  3. resize before imagejpg()
    By enzo250gto in forum PHP Development
    Replies: 0
    Last Post: November 13th, 2003, 08:47 AM
  4. Replies: 0
    Last Post: October 27th, 2003, 06:23 PM
  5. Replies: 0
    Last Post: October 26th, 2003, 02:20 AM

IMN logo majestic logo threadwatch logo seochat tools logo