473,486 Members | 2,131 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ImageCreateFromJPEG() accepts horizontal images only??

jn
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
than width) images, it fails to create a resource.

What the hell is it doing?
Jul 17 '05 #1
4 2232
jn
"jn" <js******@cfl.rr.com> wrote in message
news:Ak********************@twister.tampabay.rr.co m...
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 than width) images, it fails to create a resource.

What the hell is it doing?


It works on all the images on my Windows machine, but only works on
horizontal ones when it runs on the Linux server.

Here's the function:

function resize ($filename, $destination, $size, $quality) {
$origImage = imagecreatefromjpeg($filename);
$origWidth = imagesx($origImage);
$origHeight = imagesy($origImage);
$factor = $origHeight/$origWidth;
$newWidth = $size;
$newHeight = $size * $factor;
$newImage = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresampled($newImage, $origImage, 0, 0, 0, 0, $newWidth,
$newHeight, $origWidth, $origHeight);
imagejpeg($newImage, $destination);
return $newHeight;
}

Jul 17 '05 #2
jn
"jn" <js******@cfl.rr.com> wrote in message
news:yx********************@twister.tampabay.rr.co m...
"jn" <js******@cfl.rr.com> wrote in message
news:Ak********************@twister.tampabay.rr.co m...
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
than width) images, it fails to create a resource.

What the hell is it doing?


It works on all the images on my Windows machine, but only works on
horizontal ones when it runs on the Linux server.

Here's the function:

function resize ($filename, $destination, $size, $quality) {
$origImage = imagecreatefromjpeg($filename);
$origWidth = imagesx($origImage);
$origHeight = imagesy($origImage);
$factor = $origHeight/$origWidth;
$newWidth = $size;
$newHeight = $size * $factor;
$newImage = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresampled($newImage, $origImage, 0, 0, 0, 0, $newWidth,
$newHeight, $origWidth, $origHeight);
imagejpeg($newImage, $destination);
return $newHeight;
}


PHP is telling me that they aren't valid JPEGs...that's the problem. :(
Jul 17 '05 #3
jn wrote:
"jn" <js******@cfl.rr.com> wrote in message
news:yx********************@twister.tampabay.rr.co m...
"jn" <js******@cfl.rr.com> wrote in message
news:Ak********************@twister.tampabay.rr. com...
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
than width) images, it fails to create a resource.

What the hell is it doing?


It works on all the images on my Windows machine, but only works on
horizontal ones when it runs on the Linux server.

Here's the function:

function resize ($filename, $destination, $size, $quality) {
$origImage = imagecreatefromjpeg($filename);
$origWidth = imagesx($origImage);
$origHeight = imagesy($origImage);
$factor = $origHeight/$origWidth;
$newWidth = $size;
$newHeight = $size * $factor;
$newImage = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresampled($newImage, $origImage, 0, 0, 0, 0, $newWidth,
$newHeight, $origWidth, $origHeight);
imagejpeg($newImage, $destination);
return $newHeight;
}

PHP is telling me that they aren't valid JPEGs...that's the problem. :(


The reason why PHP is telling you that they are not valid JPEGs I
believe has to do with thumbnails - I believe (perhaps someone in this
newsgroup will know otherwise) that jpegs can contain a small thumbnail
in the same file as the full-sized image. I think its a standard... and
I believe some digital cameras break this standard in order to create
smaller file types... I have a Sony Mavica camera that creates images on
to a floppy diskette that I bought in 19977 and it wworks fine so I know
not all camera's will give you the problem.

Since I have yet to encounter the problem, I've not been able to test a
work around - but one idea I had was to resave the image using the
gd-library and then see if I could manipulate it...

I don't know if it would owrk... in addition... I think I'll recognise
the problem if I encounter problems with width like you had.

I hope the above is some help...

laters
randelld
Jul 17 '05 #4
jn
"Randell D." <pl*******************@news.group.com> wrote in message
news:0sYtb.406842$6C4.166786@pd7tw1no...
jn wrote:
"jn" <js******@cfl.rr.com> wrote in message
news:yx********************@twister.tampabay.rr.co m...
"jn" <js******@cfl.rr.com> wrote in message
news:Ak********************@twister.tampabay.rr. com...

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

than width) images, it fails to create a resource.

What the hell is it doing?
It works on all the images on my Windows machine, but only works on
horizontal ones when it runs on the Linux server.

Here's the function:

function resize ($filename, $destination, $size, $quality) {
$origImage = imagecreatefromjpeg($filename);
$origWidth = imagesx($origImage);
$origHeight = imagesy($origImage);
$factor = $origHeight/$origWidth;
$newWidth = $size;
$newHeight = $size * $factor;
$newImage = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresampled($newImage, $origImage, 0, 0, 0, 0, $newWidth,
$newHeight, $origWidth, $origHeight);
imagejpeg($newImage, $destination);
return $newHeight;
}

PHP is telling me that they aren't valid JPEGs...that's the problem. :(


The reason why PHP is telling you that they are not valid JPEGs I
believe has to do with thumbnails - I believe (perhaps someone in this
newsgroup will know otherwise) that jpegs can contain a small thumbnail
in the same file as the full-sized image. I think its a standard... and
I believe some digital cameras break this standard in order to create
smaller file types... I have a Sony Mavica camera that creates images on
to a floppy diskette that I bought in 19977 and it wworks fine so I know
not all camera's will give you the problem.

Since I have yet to encounter the problem, I've not been able to test a
work around - but one idea I had was to resave the image using the
gd-library and then see if I could manipulate it...

I don't know if it would owrk... in addition... I think I'll recognise
the problem if I encounter problems with width like you had.

I hope the above is some help...

laters
randelld


I tried resaving the image in Photoshop, and it still wouldn't work. And I'm
not sure how I would get GD to resave it without using ImageCreateFromJPEG()
anyway.

I'm now trying to get ImageMagick to work on my server so I don't have to
worry about GD. Thanks for the help though.
Jul 17 '05 #5

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

Similar topics

2
3990
by: jn | last post by:
This is the weirdest thing I've come across in a while. I'm trying to resize an image. If I give it a small image ( < 100K) it will resize. If I give it a larger image, it gives me the IE "Action...
2
11029
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? ...
2
662
by: bernie | last post by:
Howdy, I have an image upload and resize script that I have used on a number of servers with no issues. I have now use it in a new app that I uploaded to a new server. I worked fine on my dev...
1
4976
by: RugbyTravis | last post by:
I want to have a list that is horizontal and each <li> has different images. I also want them to change on hover. I want the words to be below the images as well. Anyone of you styles gurus have...
21
20595
by: Dan V. | last post by:
I have tried a number of things including preloading, but the background image (water tile in header) in IE 6 will not display where other browsers will....
7
5088
by: J-T | last post by:
My website is fine when it is viewed in 1280 by 1024 pixel ,but in smaller resulotions there is a horizontal scrollbar down the page.How can I set it to be viewed the same for all resulotions? ...
5
3323
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 =...
1
2933
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...
12
5364
by: ryrocks | last post by:
Hello everyone! Im having a little trouble with my horizontal scrolling set of video thumbnails. I've got 6 video thumbnails that the user scrolls through horizontally, I've got this working...
0
7100
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7126
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7175
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...
0
7330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5434
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4865
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3070
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.