Jump to content

Recommended Posts

Ok I have seen many posts on this script and many people asking question on this site. The script can be found.....

 

http://www.white-hat-web-design.co.uk/blog/resizing-images-with-php/

 

However I still can not make it work with what I have got.  So here is the problem.  First of all I upload the image and save the name to the database.  I then pass its ID to the next page to retrieve the image and its path from the database.  This is where the script comes in. I then run the image through the script and send you to the success page.

 

Now the image is not being resized!  The code is not erroring (even with error reporting on).  It would seem the code it just get ignored completely. The image is still there and displays how it was uploaded but the size just hasnt changed.  Im asuming Im using it in the correct way.  Here is the code after the image has been uploaded.

 

    $Fetchq = mysql_query("SELECT * FROM images WHERE imageID ='".$_GET['image']."' ") or die('error stuff here');
    $fetched = mysql_fetch_array($Fetchq);


    $path = "/members/images/members/merseyside/{$fetched['imagename']}";


    include('SimpleImage.php');
    $image = new SimpleImage();
    $image->load('$path');
    $image->resize(60,60);   
    $image->save('$path');
   
   

     $url = "/activity-photos.php?uploaded=true";        
header("Location: $url"); 

 

Any help would be greatly appreciated as I've had enough of banging my head against this code wall

Link to comment
https://forums.phpfreaks.com/topic/261165-another-image-re-sizer-question/
Share on other sites

'$path'

Variables don't work inside single-quoted strings.

 

Not that you need them at all...

include('SimpleImage.php');
$image = new SimpleImage();
$image->load($path);
$image->resize(60,60);   
$image->save($path);

thanks requinix for your reply however that did not solve it.  Still the same issues.  No errors even with reporting and file is still the same size. The image is also definitely loading into the page as I have checked that too.  Here is the code as stands

 


$path = '/members/images/merseyside/'.$fetched['imageName'].'';


include('SimpleImage.php');
$image = new SimpleImage();
   $image->load($path);
$image->resize(60,60);   
$image->save($path);
   
   

$url = "/activity-photos.php?uploaded=true";        
header("Location: $url");  

 

ok I managed to get myself some errors.  Here is what I got

 

Warning: getimagesize(/members/images/members/Merseyside/0b12dd48f09fafc2e2985743cca2029flazy-grass-2.jpg) [function.getimagesize]: failed to open stream: No such file or directory in/members/clubs/SimpleImage.php on line 30

 

Warning: imagesx(): supplied argument is not a valid Image resource in /members/clubs/SimpleImage.php on line 73

 

Warning: Division by zero in /members/clubs/SimpleImage.php on line 87

 

Warning: imagesy(): supplied argument is not a valid Image resource in /members/clubs/SimpleImage.php on line 77

 

Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /members/clubs/SimpleImage.php on line 99

 

Warning: imagesx(): supplied argument is not a valid Image resource in /members/clubs/SimpleImage.php on line 73

 

Warning: imagesy(): supplied argument is not a valid Image resource in /members/clubs/SimpleImage.php on line 77

 

Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /members/clubs/SimpleImage.php on line 100

 

Warning: imagejpeg(): supplied argument is not a valid Image resource in /members/clubs/SimpleImage.php on line 46

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.