internal error > imagecreatefromjpeg for large diamension
Moderators: onion2k, General Moderators
-
shuchitaumehta
- Forum Newbie
- Posts: 15
- Joined: Tue Jul 01, 2008 2:10 am
internal error > imagecreatefromjpeg for large diamension
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
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
-
sureshmaharana
- Forum Commoner
- Posts: 30
- Joined: Thu Jul 03, 2008 4:20 am
- Contact:
Re: internal error > imagecreatefromjpeg for large diamension
<?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>'; */
?>
$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>'; */
?>
-
shuchitaumehta
- Forum Newbie
- Posts: 15
- Joined: Tue Jul 01, 2008 2:10 am
Re: internal error > imagecreatefromjpeg for large diamension
thanx for replayingsureshmaharana 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>'; */
?>
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
-
sureshmaharana
- Forum Commoner
- Posts: 30
- Joined: Thu Jul 03, 2008 4:20 am
- Contact:
Re: internal error > imagecreatefromjpeg for large diamension
What error you are getting? I am not getting any error and it works fine in my PC.
-
shuchitaumehta
- Forum Newbie
- Posts: 15
- Joined: Tue Jul 01, 2008 2:10 am
Re: internal error > imagecreatefromjpeg for large diamension
in FF i getsureshmaharana wrote:What error you are getting? I am not getting any error and it works fine in my PC.
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
-
sureshmaharana
- Forum Commoner
- Posts: 30
- Joined: Thu Jul 03, 2008 4:20 am
- Contact:
Re: internal error > imagecreatefromjpeg for large diamension
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/
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
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 ????
Hic, any one know how to make it work with big size image ????
Re: internal error > imagecreatefromjpeg for large diamension
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
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
Only if the script uses less than 30 meg during execution.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
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.