With the following code, my browser is returning 'image not created or saved'. I assure you the location of the image exists. So the line within the if statement is returning false for some reason, and yes GD is installed. Any ideas?
if ($img = @imagecreatefromjpeg("/var/www/images/upload/1/1.jpg")) {
die("image was created");
} else {
die ("image was not created or saved");
}
OK, I did this:
<?php
error_reporting(E_ALL);
if (fopen('/var/www/images/upload/1/1.jpg')) {
echo 'file was opened';
} else {
echo 'file was not opened';
}
?>
It returns file was not opened every time, the apache group has all permissions for all of these folders. Is GD or PHP a different username?
After doing an is_readable() from a test script, it returned true. What else could the problem be?
So... when I run the script:
error_reporting(E_ALL);
imagecreatefromjpeg("/var/www/images/upload/1/1.jpg");
print_r(error_get_last());
echo ("hi");
I receive a white screen of death. If I comment out the imagecreatefromjpeg line, the screen displays 'hi'
Just tried this on a 500k jpg image to see if it's a memory issue, but still got the white screen.
When I run the imagecreatefromjpeg within an if statement and run the script through the terminal, the imagecreatefromjpeg is a success! =\ Still can't figure out why it wouldn't work otherwise. EDIT: Running this exact script through my browser also is a success.