Ok I have seen many posts on this script. Which 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
$image->save('$path');If you use a variable inside single quotes, it treats it as an actual string not the variable value.
Solution:
$image->save( $path ); // Remove the quotesor
$image->save( "$path" ); // Replace with double quotesEDIT:
Also, be sure to change
$image->load()as wellYou can learn more about string interpolation here:
http://php.net/manual/en/language.types.string.php