Page 1 of 1

internal error > imagecreatefromjpeg for large diamension

Posted: Mon Jul 14, 2008 3:02 am
by shuchitaumehta
hello,

for image resize i use
imagecreatefromjpeg but it not working for big images
it gives

Internal Server Error, this is an error with your script, check your error log for more information.

can you please help me..?

thanks in advance

Re: internal error > imagecreatefromjpeg for large diamension

Posted: Mon Jul 14, 2008 4:50 am
by sureshmaharana
<?php
$add = 'Water lilies.jpg';
$n_width = 100;
$n_height = 100;
$tsrc="img/Water lilies.jpg";// Create img folder to store resized image. Give the correct path to store resized image.
$im=ImageCreateFromJPEG($add);
$width=ImageSx($im); // Original picture width is stored
$height=ImageSy($im); // Original picture height is stored
$newimage=imagecreatetruecolor($n_width,$n_height);
imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
ImageJpeg($newimage,$tsrc);
chmod("$tsrc",0777);

//echo '<img src=""'.ImageJpeg($newimage).'""></img>';

echo '<img src="img/Water lilies.jpg"></img>';

/* if you dont want to store image then just comment ImageJpeg($newimage,$tsrc); chmod("$tsrc",0777); echo '<img src="img/Water lilies.jpg"></img>'; and uncomment //echo '<img src=""'.ImageJpeg($newimage).'""></img>'; */
?>

Re: internal error > imagecreatefromjpeg for large diamension

Posted: Mon Jul 14, 2008 5:24 am
by shuchitaumehta
sureshmaharana wrote:<?php
$add = 'Water lilies.jpg';
$n_width = 100;
$n_height = 100;
$tsrc="img/Water lilies.jpg";// Create img folder to store resized image. Give the correct path to store resized image.
$im=ImageCreateFromJPEG($add);
$width=ImageSx($im); // Original picture width is stored
$height=ImageSy($im); // Original picture height is stored
$newimage=imagecreatetruecolor($n_width,$n_height);
imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
ImageJpeg($newimage,$tsrc);
chmod("$tsrc",0777);

//echo '<img src=""'.ImageJpeg($newimage).'""></img>';

echo '<img src="img/Water lilies.jpg"></img>';

/* if you dont want to store image then just comment ImageJpeg($newimage,$tsrc); chmod("$tsrc",0777); echo '<img src="img/Water lilies.jpg"></img>'; and uncomment //echo '<img src=""'.ImageJpeg($newimage).'""></img>'; */
?>
thanx for replaying

yes you are right i wrote same but

$im=ImageCreateFromJPEG($add);

at this line server not responding

if i write till this line & run

it gives error

i feel its some memory/ time problem
because for small size file it works fine

please help

thanx

Re: internal error > imagecreatefromjpeg for large diamension

Posted: Mon Jul 14, 2008 5:30 am
by sureshmaharana
What error you are getting? I am not getting any error and it works fine in my PC.

Re: internal error > imagecreatefromjpeg for large diamension

Posted: Mon Jul 14, 2008 5:36 am
by shuchitaumehta
sureshmaharana wrote:What error you are getting? I am not getting any error and it works fine in my PC.
in FF i get

Internal Server Error, this is an error with your script, check your error log for more information.

it works fine on my PC but on server i get this error

i set ini memory_limit 350M
also set_time_limit also but still its giving error

i dont know whats the problem ..?

thank you

Re: internal error > imagecreatefromjpeg for large diamension

Posted: Mon Jul 14, 2008 6:06 am
by sureshmaharana
When running a Perl CGI script, you may see the "Internal Server Error" message in your browser. The message will usually also say something like "please check the server's error-log for more information." You should do that -- the message printed to the error log will often tell you exactly what the problem is. The Apache error log, for example, is often located at /var/log/apache/error_log or /var/log/apache2/error_log (or sometimes "error.log").

If you don't have access to the error log, the next simplest thing to do is to make a copy of the script, then open the original and delete all of its contents, and add just these 3 lines to the file:


#!/usr/bin/perl
print "Content-type: text/plain\n\n";
print "testing...\n";

(Note: if the server is a Windows system, then replace the first line above with either #!perl or #!c:\path\to\perl.exe.)

Now try to access the page in your browser again. If it works (you see "testing..." as its output) then you know that your server is at least configured properly for running Perl CGI scripts. If it doesn't work, then that may mean the problem is in the server configuration, rather than with your CGI script. (For example, are you sure you actually have Perl installed? Virtually all UNIX/Linux/OS X servers do, but Windows servers usually need to have it installed manually, from a package like ActivePerl.)



For detail information please visit
http://encodable.com/internal_server_error/

Re: internal error > imagecreatefromjpeg for large diamension

Posted: Sun Oct 12, 2008 1:34 am
by iam_htd
I got the same trouble with you. I also know this problem related to memory usage, but I cant fix it.
Hic, any one know how to make it work with big size image ???? :?

Re: internal error > imagecreatefromjpeg for large diamension

Posted: Sun Oct 12, 2008 1:43 am
by iam_htd
Oh my god, I found the way to fix it now.
You could try to get around this by adding a line like:

ini_set("memory_limit","30M");

at the top of your script.
It'll work ^^ Enjoy

Re: internal error > imagecreatefromjpeg for large diamension

Posted: Sun Oct 12, 2008 4:30 am
by onion2k
iam_htd wrote:Oh my god, I found the way to fix it now.
You could try to get around this by adding a line like:

ini_set("memory_limit","30M");

at the top of your script.
It'll work ^^ Enjoy
Only if the script uses less than 30 meg during execution.

Image stuff uses a lot of memory. I work with images loads, and I've got PHP configured to use 2 gigabytes... although that's not on a live server obviously.