473,386 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

imagecreatefromjpeg not working

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.
Jul 17 '05 #1
4 21585
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>
Jul 17 '05 #2
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" <if**********@comcast.net> wrote in message news:<bt************@ID-30799.news.uni-berlin.de>...
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>

Jul 17 '05 #3
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:
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" <if**********@comcast.net> wrote in message
news:<bt************@ID-30799.news.uni-berlin.de>...
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>

Jul 17 '05 #4
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" <if**********@comcast.net> wrote in message news:<bt************@ID-30799.news.uni-berlin.de>...
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:
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" <if**********@comcast.net> wrote in message
news:<bt************@ID-30799.news.uni-berlin.de>...
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>

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: jn | last post by:
I'm working with images from a Kodak 2MP camera. It looks like the function will only create a resource if I give it horiznotal pictures from this camera....if I give it vertical (height larger...
2
by: Simon Stewart | last post by:
Has anyone else experience of imagecreatefromjpeg failing with an error message about memory even though the size of the image being uploaded is nothing like the space available to the script? ...
1
by: Olivier | last post by:
Hi, I have the following code in my php script : $fhSrc = imagecreatefromjpeg($srcFile); This cause me the following error : Fatal error: Allowed memory size of 8388608 bytes exhausted (tried...
5
by: steve park | last post by:
Hi everyone, this is one of those "inherited from someone else" projects that I'm having problems with and was wondering if someone could help me out. Our setup: Redhat Linux Apache 2.0.46...
6
by: comp.lang.php | last post by:
PHP version 4.3.9 GD version 2.0.2 Whenever I use imagecreatefromjpeg(), PHP completely dies. No errors, no warnings, no notices, it dies in the following manner: If using Firefox it just...
5
by: Areric | last post by:
Ok all. I have a series of images stored in a db. Im trying to work on a script that will let me scale them based on user input. Ive hit a bit of a roadblock on this line. $orig =...
4
by: jeffsnox | last post by:
Hi, I'm struggling to get imagecreatefromjpeg to work correctly. I'm running PHP 4.3.9 with GD bundled (2.0.28 compatible). If I run this: $myimage = imagecreatefromjpeg("myfilename");
1
by: tim.landgraf | last post by:
hi there, i am experiencing a strange problem. i am iterating through a given directory, selecting only jpg - images that are then resized and inserted into a database. everything works, but if...
23
by: Silencet | last post by:
Hi all, I, like alot of others, have been working with a script to create thumbnails, however, i've a problem were the script works, however just stops when it reaches the imagecreatefromjpeg...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.