SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    is craving 'the potato' slayerment's Avatar
    Join Date
    Nov 2002
    Location
    Scottsdale, Arizona, USA
    Posts
    603
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question: Resizing Uploaded Image Copy

    *edit*
    Last edited by slayerment; Mar 25, 2004 at 01:49.

  2. #2
    is craving 'the potato' slayerment's Avatar
    Join Date
    Nov 2002
    Location
    Scottsdale, Arizona, USA
    Posts
    603
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    *bump*

    Hi, I'm still having problems with resizing my image. I tried just doing a quick hardcode test and it's not working. The image I'm uploading is 640 x 480 px and I'm wanting the resized one to be 140 x 105 px.

    Here's my code... the first copy works fine, but the resize gives me this error:
    Warning: imagecopyresized(): supplied argument is not a valid Image resource
    PHP Code:
    $myPath="/home/slayerm/public_html/nv/images/tenants/test/";
    if (
    $_FILES['imagefile']['type'] == "image/pjpeg"){
            
    copy ($_FILES['imagefile']['tmp_name'], $myPath.$address.".jpg")
            or die (
    "Could not copy");
            
    imagecopyresized("images/tenants/test/test_copy.jpg""images/tenants/test/test.jpg"0000140105640480);
            } 
    Any help would be great. Thanks .

  3. #3
    SitePoint Addict CandyMann_69's Avatar
    Join Date
    Jun 2003
    Location
    Phoenix, AZ
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe try something like this

    PHP Code:
    $myPath="./images/tenants/test/";
    if (
    $_FILES['imagefile']['type'] == "image/pjpeg"){
            
    copy ($_FILES['imagefile']['tmp_name'], $myPath.$address.".jpg")
            or die (
    "Could not copy");
            
    imagecopyresized ($myPath.$address.".jpg"$myPath."images/tenants/test/test.jpg"0000140105640480);
            } 

  4. #4
    is craving 'the potato' slayerment's Avatar
    Join Date
    Nov 2002
    Location
    Scottsdale, Arizona, USA
    Posts
    603
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the response, however, it's still giving me the following error:

    Warning: imagecopyresized(): supplied argument is not a valid Image resource.

  5. #5
    SitePoint Addict CandyMann_69's Avatar
    Join Date
    Jun 2003
    Location
    Phoenix, AZ
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you doing anything to the file before this code?

  6. #6
    is craving 'the potato' slayerment's Avatar
    Join Date
    Nov 2002
    Location
    Scottsdale, Arizona, USA
    Posts
    603
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's the full part of my code:

    PHP Code:
    dbConnect("slayerm_newvalley");
    $myPic=$address.".jpg";
    $myPath="./images/tenants/test/";
    $sql="INSERT INTO tenants SET date_added='".date("Y m d")."',address='$address', location='$location',avail='$avail',price_mo='$priceMO',price_sd='$priceSD',info='$info',type='$type',pic='$myPic'";
    $result=mysql_query($sql);
    if (
    $_FILES['imagefile']['type'] == "image/pjpeg"){
            
    copy ($_FILES['imagefile']['tmp_name'], $myPath.$address.".jpg")
            or die (
    "Could not copy");
            
    imagecopyresized($myPath.$address.".jpg""images/tenants/test/test.jpg"0000140105640480);



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •