473,554 Members | 3,068 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 imagecreatefrom jpeg() function
3. use imagecopyresamp led 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 2892
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 imagecreatefrom jpeg() function
3. use imagecopyresamp led 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
4075
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: http://us4.php.net/manual/en/function.imagejpeg.php http://us4.php.net/manual/en/function.imagepng.php -Josh
15
19063
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 = imagecolorallocate($image, 255, 0, 0); imagefill($image, 0, 0, $colorRed);
4
21630
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 assume I will need more? phpinfo() says: gd
3
3496
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 for adding some text on it and then send it to somebody: here is the code: $image = "/include/images/model.jpg"; $src =...
121
9966
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 support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather...
5
3026
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 simple code to create a graph in an existing php page. I added the code for the graph and added the elements of it plus some static data. However,...
0
1477
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 4.0.6 on Appache server under linux operating system. so plz if someone have an idea about the problem plz answer me. <?php
3
4488
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 my objective is this that when i uplod a file it should be desply on same page with ajax uplod after when i refresh page this should be not remains...
0
1236
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; $file_desination2 = $compressedPath; list($width_orig, $height_orig, $type) = getimagesize($file_name_src); if($type == "1" )
0
7519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7798
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8039
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6140
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5431
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5152
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3556
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2015
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
838
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.