Imaulle Posted November 10, 2010 Share Posted November 10, 2010 Hello, I have a script that will resize all images in a directory.. the script functions properly on my normal hosting (through hostgator) but when I try to run the script on a GoDaddy site, the script will only get about half way done and then just stop without any errors. I've checked the max_execution_time and it's set to 90 but the script seems to stop after around 25 seconds. I wrote another script that was just a for loop with sleep(1) to run 90 times and it did without any issues.. I was thinking it was a memory error but I don't get any fatal errors saying so... I know its something to do with the config of GoDaddy but I can't figure out the exact cause. the server does have PHP5 installed and the only error i can even get to throw through the GoDaddy logs is a warning about ./json.so not being able to load.. Can anyone think of anything off the top of their head that could cause this to happen only on GoDaddy? this is the gist of the function but its been modified a tiny bit... (only filenames that are created etc) <?php // The file $filename = 'test.jpg'; // Set a maximum height and width $width = 200; $height = 200; // Content type header('Content-type: image/jpeg'); // Get new dimensions list($width_orig, $height_orig) = getimagesize($filename); $ratio_orig = $width_orig/$height_orig; if ($width/$height > $ratio_orig) { $width = $height*$ratio_orig; } else { $height = $width/$ratio_orig; } // Resample $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); // Output imagejpeg($image_p, null, 100); ?> thanks! Quote Link to comment https://forums.phpfreaks.com/topic/218297-script-on-godaddy/ Share on other sites More sharing options...
BlueSkyIS Posted November 10, 2010 Share Posted November 10, 2010 i would turn on all error_reporting() and check permissions on file destinations. also, check to make sure GD is in PHP. Quote Link to comment https://forums.phpfreaks.com/topic/218297-script-on-godaddy/#findComment-1132644 Share on other sites More sharing options...
Imaulle Posted November 10, 2010 Author Share Posted November 10, 2010 in php5.ini I have: error_reporting = E_ALL; still no errors the file destinations isn't an issue the directory and contents is set to 777. The script works perfectly on about half of the images, it just stops before it should... it's like it can't read the full file list? there are about 200 images in the directory and it resizes 90~ each time I checked and GD is in PHP GD Support enabled GD Version bundled (2.0.34 compatible) Quote Link to comment https://forums.phpfreaks.com/topic/218297-script-on-godaddy/#findComment-1132651 Share on other sites More sharing options...
BlueSkyIS Posted November 10, 2010 Share Posted November 10, 2010 i'd insert echo's into the code and view the output while it's happening to see where it dies. Quote Link to comment https://forums.phpfreaks.com/topic/218297-script-on-godaddy/#findComment-1132656 Share on other sites More sharing options...
Imaulle Posted November 10, 2010 Author Share Posted November 10, 2010 yup I tried that too. nothing it's like it thinks it reached the end of the directory, but it hasn't Quote Link to comment https://forums.phpfreaks.com/topic/218297-script-on-godaddy/#findComment-1132659 Share on other sites More sharing options...
Imaulle Posted December 17, 2010 Author Share Posted December 17, 2010 bumping I still never resolved this I am 100% sure that it's not my script now... How can I make sure that the script has access to all of the files in the folder? There is something wrong with the .htaccess file or something that is preventing the script from seeing all of the files... any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/218297-script-on-godaddy/#findComment-1148518 Share on other sites More sharing options...
Saum Posted January 16, 2011 Share Posted January 16, 2011 You need to set your headers. header('Content-type: image/jpeg'); Quote Link to comment https://forums.phpfreaks.com/topic/218297-script-on-godaddy/#findComment-1160130 Share on other sites More sharing options...
QuickOldCar Posted January 16, 2011 Share Posted January 16, 2011 http://php.net/manual/en/function.imagedestroy.php Quote Link to comment https://forums.phpfreaks.com/topic/218297-script-on-godaddy/#findComment-1160133 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.