473,782 Members | 2,525 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 2905
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
4085
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
19103
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
21679
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
3514
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 = imagecreatefromjpeg($image); $size = getimagesize($image);
121
10179
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 than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
5
3041
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, when I browse the page, I get garbled data instead of the graph. Has anyone ever run into this...
0
1509
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
4513
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 longer and on clicking other image its replase previous image plz help how i can do this the...
0
1249
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
9480
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10146
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9944
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6735
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2875
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.