| | |
png image croping problem
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2009
Posts: 94
Reputation:
Solved Threads: 7
hi all. i want to crop png image.
when i am croping the png image i got "Fatal error: imagepng() [<a href='function.imagepng'>function.imagepng</a>]: gd-png: fatal libpng error: zlib error in C:\wamp\www\taslan\admin\products.php on line 120" error message. at line no 120 shows imagepng($bgim_new,$bgth_file_name,100); this function
when i am croping the png image i got "Fatal error: imagepng() [<a href='function.imagepng'>function.imagepng</a>]: gd-png: fatal libpng error: zlib error in C:\wamp\www\taslan\admin\products.php on line 120" error message. at line no 120 shows imagepng($bgim_new,$bgth_file_name,100); this function
•
•
Join Date: Sep 2009
Posts: 557
Reputation:
Solved Threads: 64
0
#2 Nov 7th, 2009
•
•
•
•
hi all. i want to crop png image.
when i am croping the png image i got "Fatal error: imagepng() [<a href='function.imagepng'>function.imagepng</a>]: gd-png: fatal libpng error: zlib error in C:\wamp\www\taslan\admin\products.php on line 120" error message. at line no 120 shows imagepng($bgim_new,$bgth_file_name,100); this function
It should have the value from 0 to 9 only, you used the much higher value for it
"The discipline of writing something down is the first step towards making it happen."
follow me on twitter
follow me on twitter
•
•
Join Date: Nov 2009
Posts: 94
Reputation:
Solved Threads: 7
0
#3 Nov 7th, 2009
k. its working . but this function not supporting .bmp image files.
" " and also i put 100 like this still not working
"
PHP Syntax (Toggle Plain Text)
imagewbmp($bgim_new, $bgth_file_name,9);
PHP Syntax (Toggle Plain Text)
imagewbmp($bgim_new, $bgth_file_name,100);
2
#4 Nov 7th, 2009
Hey.
If you are having problems with functions, look them up in the manual.
The third parameter of the imagewbmp function is not the same as the third parameter for the png function. The manual explains the difference. Even gives examples.
If you are having problems with functions, look them up in the manual.
The third parameter of the imagewbmp function is not the same as the third parameter for the png function. The manual explains the difference. Even gives examples.
Please do not ask for help in a PM. Use the forums.
And use [code] tags!
And use [code] tags!
•
•
Join Date: Sep 2009
Posts: 557
Reputation:
Solved Threads: 64
•
•
•
•
k. its working . but this function not supporting .bmp image files.
"" and also i put 100 like thisPHP Syntax (Toggle Plain Text)
imagewbmp($bgim_new, $bgth_file_name,9);still not workingPHP Syntax (Toggle Plain Text)
imagewbmp($bgim_new, $bgth_file_name,100);
and the imagewbmp() is not having the same parameters as like imagepng().
The 1st parameter to imagewbmp() is the image resource , 2nd is the file path and the 3rd is the forground color to be specified as the int value.The default value to it that of the black color.
"The discipline of writing something down is the first step towards making it happen."
follow me on twitter
follow me on twitter
•
•
Join Date: Nov 2009
Posts: 94
Reputation:
Solved Threads: 7
0
#6 34 Days Ago
•
•
•
•
The 3rd optional parameter to the imagepng() is called the quality and it specifies the compression level used.
It should have the value from 0 to 9 only, you used the much higher value for it
i am facing another problem with this. i used values between '0' to '9' then image background color is changing like black. what is alternative for this?
•
•
Join Date: Sep 2009
Posts: 557
Reputation:
Solved Threads: 64
0
#7 34 Days Ago
•
•
•
•
hello,
i am facing another problem with this. i used values between '0' to '9' then image background color is changing like black. what is alternative for this?
Look for setImageBackgroundColor() function of the Imagick.
"The discipline of writing something down is the first step towards making it happen."
follow me on twitter
follow me on twitter
•
•
Join Date: Nov 2009
Posts: 94
Reputation:
Solved Threads: 7
0
#8 34 Days Ago
•
•
•
•
imagewbmp() sets the foreground color.
Look for setImageBackgroundColor() function of the Imagick.
•
•
Join Date: Nov 2009
Posts: 94
Reputation:
Solved Threads: 7
0
#9 34 Days Ago
•
•
•
•
imagewbmp() sets the foreground color.
Look for setImageBackgroundColor() function of the Imagick.
PHP Syntax (Toggle Plain Text)
$bgim_new = imagecreatetruecolor($bgth_width,$bgth_height); imageantialias($bgim_new,true); $bgth_file_name = "productimages/140X150/$Attachments1"; imagecopyresampled($bgim_new,$bgim_old,0,0,0,0,$bgth_width,$bgth_height, $bgimage_attribs[0], $bgimage_attribs[1]); if(($filetype1=='image/png') || ($filetype1=='image/x-png') ||($filetype1=='image/PNG') || ($filetype1=='image/X-PNG')) { imagepng($bgim_new,$bgth_file_name,9); } else if(($filetype1 == "image/bmp") || ($filetype1 == "image/BMP")) { imagewbmp($bgim_new, $bgth_file_name,$bgim_new); }
0
#10 34 Days Ago
You are using the imagewbmp function incorrectly.
The third parameter of the imagewbmp function sets the foreground color of the image to a color created by the imagecolorallocate function.
Look at the third example in the manual. It shows how to correctly use the third parameter.
The third parameter of the imagewbmp function sets the foreground color of the image to a color created by the imagecolorallocate function.
Look at the third example in the manual. It shows how to correctly use the third parameter.
Last edited by Atli; 34 Days Ago at 10:28 am. Reason: Typos
Please do not ask for help in a PM. Use the forums.
And use [code] tags!
And use [code] tags!
![]() |
Similar Threads
- Image upload problem (PHP)
- PNG and BMP image resizing problem (PHP)
- Image resizw problem (HTML and CSS)
- Background Image Repeat Problem (HTML and CSS)
- Problem with PHP + GD - PNG Image Quality and Transparency problems (PHP)
- Flash 8 PNG Image as Mask (Graphics and Multimedia)
- Image Generation Problem (PHP)
Other Threads in the PHP Forum
- Previous Thread: Passing variable as a link
- Next Thread: Tiles Matching Game, Sessions 1D array // random_shuffle()
Views: 419 | Replies: 14
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download duplicates dynamic echo email error execution file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link links login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote replace script search select server session sessions sms soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web xml youtube





