Connecting Tech Pros Worldwide Forums | Help | Site Map

imagecreatefromjpeg not working

Mike
Guest
 
Posts: n/a
#1: Jul 17 '05
hopefully this is an easy one to solve and I'm just missing something
little...

basically, I had a nice little website running with php, apache,
etc... that uses imagecreatefromjpeg to create thumbnails of larger
pictures.

recently, I upgraded my system from suse 8.2 to suse 9.0, so I assume
my php/apache rpms were upgraded in the process...

Unfortunately, now, imagecreatefromjpeg no longer works on pictures
taken with 1 of my 2 cameras - All of the ones with a Sony p30 work
just fine, whereas if I run the function on pictures taken with a
cannon powershot s400, execution of the PHP script stops. Nothing in
the logs, nothing output to the screen, etc...

Here is a snippet of code that I use:
$size = getimagesize($picturePath);

$width = $size[0] * $x / 100;
$height = $size[1] * $y / 100;
$im = @imagecreatefromjpeg($picturePath);
$newim = imagecreatetruecolor($width,$height);
ImageCopyResized($newim,$im,0,0,0,0,$width,$height ,ImageSX($im),ImageSY($im));

If I put an echo right before and right after the
$im=@imagecreatefromjpeg line, the first echo prints out, the second
does not - so php stops parsing, executing the document.

Again, this worked in the past, and I can't figure out why it wouldn't
now. Here is some info from my setup:

php 4.3.3

'./configure' '--prefix=/usr/share' '--datadir=/usr/share/php'
'--bindir=/usr/bin' '--libdir=/usr/share' '--includedir=/usr/include'
'--sysconfdir=/etc' '--with-_lib=lib' '--with-config-file-path=/etc'
'--with-exec-dir=/usr/lib/php/bin' '--disable-debug' '--enable-bcmath'
'--enable-calendar' '--enable-ctype' '--enable-dbase'
'--enable-discard-path' '--enable-exif' '--enable-filepro'
'--enable-force-cgi-redirect' '--enable-ftp' '--enable-gd-imgstrttf'
'--enable-gd-native-ttf' '--enable-inline-optimization'
'--enable-magic-quotes' '--enable-mbstr-enc-trans' '--enable-mbstring'
'--enable-mbregex' '--enable-memory-limit' '--enable-safe-mode'
'--enable-shmop' '--enable-sigchild' '--enable-sysvsem'
'--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid'
'--enable-versioning' '--enable-wddx' '--enable-yp' '--with-bz2'
'--with-dom=/usr/include/libxml2' '--with-ftp' '--with-gdbm'
'--with-gettext' '--with-gmp' '--with-imap=yes' '--with-iodbc'
'--with-jpeg-dir=/usr' '--with-ldap=yes' '--with-mcal=/usr'
'--with-mcrypt' '--with-mhash' '--with-mysql=/usr' '--with-ndbm'
'--with-pgsql=/usr' '--with-png-dir=/usr' '--with-readline'
'--with-snmp' '--with-t1lib' '--with-tiff-dir=/usr' '--with-ttf'
'--with-freetype-dir=yes' '--with-xml' '--with-xpm-dir=/usr/X11R6'
'--with-zlib=yes' '--with-qtdom=/usr/lib/qt3' '--with-gd'
'--with-openssl' '--with-curl'
'--with-swf=/usr/src/packages/BUILD/swf/dist/' '--with-imap-ssl'
'--enable-xslt' '--with-xslt-sablot' '--with-iconv' '--with-mm'
'--with-apxs=/usr/sbin/apxs' 'i586-suse-linux'

GD Support enabled
GD Version bundled (2.0.15 compatible)
FreeType Support enabled
FreeType Linkage with freetype
T1Lib Support enabled
GIF Read Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled



Any help would be amazing - I've been banging my head on this for
hours.

Thanks,
mike.

Agelmar
Guest
 
Posts: n/a
#2: Jul 17 '05

re: imagecreatefromjpeg not working


One thought: Are the two files you're trying the same size? If one is
significantly larger, it could either a) be larger than POST_MAX_FILE_SIZE
or whatever it is in php.ini or b) it could be large enough that it will
cause the script to timeout.



Mike wrote:[color=blue]
> hopefully this is an easy one to solve and I'm just missing something
> little...
>
> basically, I had a nice little website running with php, apache,
> etc... that uses imagecreatefromjpeg to create thumbnails of larger
> pictures.
>
> recently, I upgraded my system from suse 8.2 to suse 9.0, so I assume
> my php/apache rpms were upgraded in the process...
>
> Unfortunately, now, imagecreatefromjpeg no longer works on pictures
> taken with 1 of my 2 cameras - All of the ones with a Sony p30 work
> just fine, whereas if I run the function on pictures taken with a
> cannon powershot s400, execution of the PHP script stops. Nothing in
> the logs, nothing output to the screen, etc...[/color]
<snip>


Mike
Guest
 
Posts: n/a
#3: Jul 17 '05

re: imagecreatefromjpeg not working


Its a thought, but I'm pretty sure it isn't correct for 2 reasons:

1) The script always worked relatively quickly in the past - it takes
about 10-15 seconds to process 30 pictures... and the script is dying
in about .5 seconds now...

2) I'm not posting pictures - the php page is actually iterating over
files in a directory that I choose, so it wouldn't hit the
post_max_file_size.

thanks though.
mike.



"Agelmar" <ifetteNOSPAM@comcast.net> wrote in message news:<bt87gv$4d8de$1@ID-30799.news.uni-berlin.de>...[color=blue]
> One thought: Are the two files you're trying the same size? If one is
> significantly larger, it could either a) be larger than POST_MAX_FILE_SIZE
> or whatever it is in php.ini or b) it could be large enough that it will
> cause the script to timeout.
>
>
>
> Mike wrote:[color=green]
> > hopefully this is an easy one to solve and I'm just missing something
> > little...
> >
> > basically, I had a nice little website running with php, apache,
> > etc... that uses imagecreatefromjpeg to create thumbnails of larger
> > pictures.
> >
> > recently, I upgraded my system from suse 8.2 to suse 9.0, so I assume
> > my php/apache rpms were upgraded in the process...
> >
> > Unfortunately, now, imagecreatefromjpeg no longer works on pictures
> > taken with 1 of my 2 cameras - All of the ones with a Sony p30 work
> > just fine, whereas if I run the function on pictures taken with a
> > cannon powershot s400, execution of the PHP script stops. Nothing in
> > the logs, nothing output to the screen, etc...[/color]
> <snip>[/color]
Agelmar
Guest
 
Posts: n/a
#4: Jul 17 '05

re: imagecreatefromjpeg not working


Hmm... have you tried writing a separate script that just tries to open one
of the "evil" jpeg files, and on that one, don't shove an @ in front of
imagecreatefromjpeg() (so you can see what the error message is)?


Mike wrote:[color=blue]
> Its a thought, but I'm pretty sure it isn't correct for 2 reasons:
>
> 1) The script always worked relatively quickly in the past - it takes
> about 10-15 seconds to process 30 pictures... and the script is dying
> in about .5 seconds now...
>
> 2) I'm not posting pictures - the php page is actually iterating over
> files in a directory that I choose, so it wouldn't hit the
> post_max_file_size.
>
> thanks though.
> mike.
>
>
>
> "Agelmar" <ifetteNOSPAM@comcast.net> wrote in message
> news:<bt87gv$4d8de$1@ID-30799.news.uni-berlin.de>...[color=green]
>> One thought: Are the two files you're trying the same size? If one is
>> significantly larger, it could either a) be larger than
>> POST_MAX_FILE_SIZE
>> or whatever it is in php.ini or b) it could be large enough that it
>> will
>> cause the script to timeout.
>>
>>
>>
>> Mike wrote:[color=darkred]
>>> hopefully this is an easy one to solve and I'm just missing
>>> something
>>> little...
>>>
>>> basically, I had a nice little website running with php, apache,
>>> etc... that uses imagecreatefromjpeg to create thumbnails of larger
>>> pictures.
>>>
>>> recently, I upgraded my system from suse 8.2 to suse 9.0, so I
>>> assume
>>> my php/apache rpms were upgraded in the process...
>>>
>>> Unfortunately, now, imagecreatefromjpeg no longer works on pictures
>>> taken with 1 of my 2 cameras - All of the ones with a Sony p30 work
>>> just fine, whereas if I run the function on pictures taken with a
>>> cannon powershot s400, execution of the PHP script stops. Nothing
>>> in
>>> the logs, nothing output to the screen, etc...[/color]
>> <snip>[/color][/color]


Mike
Guest
 
Posts: n/a
#5: Jul 17 '05

re: imagecreatefromjpeg not working


Thank you - a brilliant idea... when I did that and and printed out
the return value from imagecreatefromjpeg(), I got the following:

Fatal error: Allowed memory size of 8388608 bytes exhausted at
(null):0 (tried to allocate 9088 bytes) in...

So I went to my php.ini file and upped the max memory and now
everything works great. That also explains why my old camera (1.3
megapixels) worked and my new one (4 megapixels) didn't.

thanks again,
mike.



"Agelmar" <ifetteNOSPAM@comcast.net> wrote in message news:<bt9o78$3uomh$1@ID-30799.news.uni-berlin.de>...[color=blue]
> Hmm... have you tried writing a separate script that just tries to open one
> of the "evil" jpeg files, and on that one, don't shove an @ in front of
> imagecreatefromjpeg() (so you can see what the error message is)?
>
>
> Mike wrote:[color=green]
> > Its a thought, but I'm pretty sure it isn't correct for 2 reasons:
> >
> > 1) The script always worked relatively quickly in the past - it takes
> > about 10-15 seconds to process 30 pictures... and the script is dying
> > in about .5 seconds now...
> >
> > 2) I'm not posting pictures - the php page is actually iterating over
> > files in a directory that I choose, so it wouldn't hit the
> > post_max_file_size.
> >
> > thanks though.
> > mike.
> >
> >
> >
> > "Agelmar" <ifetteNOSPAM@comcast.net> wrote in message
> > news:<bt87gv$4d8de$1@ID-30799.news.uni-berlin.de>...[color=darkred]
> >> One thought: Are the two files you're trying the same size? If one is
> >> significantly larger, it could either a) be larger than
> >> POST_MAX_FILE_SIZE
> >> or whatever it is in php.ini or b) it could be large enough that it
> >> will
> >> cause the script to timeout.
> >>
> >>
> >>
> >> Mike wrote:
> >>> hopefully this is an easy one to solve and I'm just missing
> >>> something
> >>> little...
> >>>
> >>> basically, I had a nice little website running with php, apache,
> >>> etc... that uses imagecreatefromjpeg to create thumbnails of larger
> >>> pictures.
> >>>
> >>> recently, I upgraded my system from suse 8.2 to suse 9.0, so I
> >>> assume
> >>> my php/apache rpms were upgraded in the process...
> >>>
> >>> Unfortunately, now, imagecreatefromjpeg no longer works on pictures
> >>> taken with 1 of my 2 cameras - All of the ones with a Sony p30 work
> >>> just fine, whereas if I run the function on pictures taken with a
> >>> cannon powershot s400, execution of the PHP script stops. Nothing
> >>> in
> >>> the logs, nothing output to the screen, etc...
> >> <snip>[/color][/color][/color]
Closed Thread