473,503 Members | 2,313 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem using GD library ImageJPEG function

hello newsgroup,

I just discovered a weird effect in my php code. here is the flow of my
code:
1. upload jepg file to server
2. create new (empty) jpeg file using imagecreatefromjpeg() function
3. use imagecopyresampled to resize src image and store in newly created
image from step 2.
4. use imagejpeg to get new jpeg data
5. store that data in the mysql database

NOW: when i use imagejpeg using 100% image quality, some images in the
database are corrupt, but NOT ALL only some of them.

when i reduce image quality to 60% i had no problem using a picture
which hat problem with 100%. images are ok this way.

does this have some logical explanation? is this a bug in the gd or
something?

I use PHP 5.0.2, GD bundled (2.0.28 compatible), and mysql 4.x

I will analyze that code in more detail...
thanx !
andré

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 17 '05 #1
1 2887
André Gasser schrieb:
hello newsgroup,

I just discovered a weird effect in my php code. here is the flow of my
code:
1. upload jepg file to server
2. create new (empty) jpeg file using imagecreatefromjpeg() function
3. use imagecopyresampled to resize src image and store in newly created
image from step 2.
4. use imagejpeg to get new jpeg data
5. store that data in the mysql database

NOW: when i use imagejpeg using 100% image quality, some images in the
database are corrupt, but NOT ALL only some of them.

when i reduce image quality to 60% i had no problem using a picture
which hat problem with 100%. images are ok this way.

does this have some logical explanation? is this a bug in the gd or
something?

I use PHP 5.0.2, GD bundled (2.0.28 compatible), and mysql 4.x

I will analyze that code in more detail...
thanx !
andré

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet
News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+
Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

WOW!

Images become good if I use the call:

imageinterlace($myimage, true);

the doc says, that in this way, a progressive jpeg is created.

they even get good if I use a quality of 100%!!

very strange......

can someone explain this behaviour to me? thx! :-)

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 17 '05 #2

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

Similar topics

2
4070
by: Joshua Beall | last post by:
According to the PHP manual, imagejpeg and imagepng have a return value of type "int" - but I do not see where it says what the values mean. Can anyone enlighten me? Here are the manual pages:...
15
19052
by: Uncle_Alias | last post by:
I would like use some of the GD image functions, so I ran a couple of short scripts to see if it worked, such as: <?php /* Create a red square */ $image = imagecreate(200, 200); $colorRed =...
4
21604
by: xcomm | last post by:
I tried to create some images with php and gd and get always Call to undefined function imagejpeg() or Call to undefined function imagepng() PHP was build with --with-gd --with-zlib but I...
3
3488
by: Bob Bedford | last post by:
I'm trying to add an imagejpeg result as an attachment of an email. For creating the email I'm using phpmailer class (http://phpmailer.sourceforge.net/) Now I do create an image from a jpeg file...
121
9904
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
5
3019
by: Shawn Hamzee | last post by:
Hello All, I am having a problem with Image_Graph on php 5.1.4. I installed the package and all of its dependencies through pear installer without any hitches. Then I started to add some very...
0
1465
by: Akkad | last post by:
ok let met tell u what is the problem , i have downloaded the code GD library code from interent and when i am using it the picture is not appearing on the page. i don't know why ? i am using PHP...
3
4480
by: kksandeep | last post by:
i am using this three files to uplod file. i got this file from net but i think these have some error. i am new to this field plz help the script i found is some helpful but not too that i need ...
0
1230
AMT India
by: AMT India | last post by:
I have an image resizing function using GD Library in php.After resizing the gif images,they lose their animation properties. $file_name_src = $upload_file;...
0
7316
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...
1
6976
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
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
5566
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
4993
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
4666
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
3160
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...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
372
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.