Home
Forums
Articles
Glossary
Awards
Register
Rules
Members
Search
Today's Posts
Mark Forums Read
Account Login
User Name
Password
Remember Me?
Latest Articles
The basic usage of PHPTAL, a XML/XHTML template library for PHP
by
awuehr
on
11-10-2008
in
Tips & Tricks
Vulnerable methods and the areas they are commonly trusted in.
by
Village Idiot
on
11-04-2008
in
Classes & Objects
Simple way to protect a form from bot
by
codefreek
on
10-23-2008
in
Basic
The Basics On: How Session Stealing Works
by
wiifanatic
on
09-12-2008
in
Security & Permissions
How to keep your forms from double posting data
by
drewbee
on
07-03-2008
in
Tips & Tricks
IRC Channel
Join the friendly bunch on IRC...
(
#TalkPHP on Freenode
)
...Also available via a
web interface
.
See
this thread
for information on the TalkPHP Free Hugs Initiative™.
Subject to availability.
Associates
Wired Flame
ClientExec
Handy PHP
PHP Kitchen
PHP Tutorials
Insane Visions
Associates
TalkPHP
>
Developer Forums
>
General
»
GD creates bloated pngs.
LinkBack
Thread Tools
Search this Thread
Display Modes
04-08-2008, 06:27 PM
#
1
(
permalink
)
johnN
The Wanderer
Join Date: Apr 2008
Posts: 8
Thanks: 2
GD creates bloated pngs.
Basically after using GD to resize and crop images I'm getting massive (and I mean massive) file sizes:
this image:
http://www.wastemylunch.com/thumbnai...144752_big.png
is 256x80 px and it's 64kb.
This is without compression, with it I get 40kb which is still crazy.
This is all using imagecreatetruecolor
when i use only imagecreate I get small but icky files.
any suggestions?
thanks!
Also, if anyone knows if the pngs could just been transformed (and saved) as gifs that are smaller that would be great.
04-08-2008, 07:16 PM
#
2
(
permalink
)
mortisimus
The Contributor
Join Date: Sep 2007
Location: London, UK
Posts: 47
Thanks: 4
I assume that at the end of the script you use:
PHP Code:
imagepng
(
$img
);
This function has a
quality
parameter, which is set on a scale of 0-9, so I guess just make this quality lower. If that doesn't work, just generate a jpeg with:
PHP Code:
imagejpeg
(
$var
);
or
PHP Code:
imagegif
(
$var
);
See also:
imagepng
imagegif
imagewbmp
imagejpeg
The Following User Says Thank You to mortisimus For This Useful Post:
johnN
(04-08-2008)
04-08-2008, 07:27 PM
#
3
(
permalink
)
johnN
The Wanderer
Join Date: Apr 2008
Posts: 8
Thanks: 2
Thanks a load, I was under the assumption you couldn't use imagegif for png images but I was wrong, thats for solving my issue so quickly and simply!
04-08-2008, 07:33 PM
#
4
(
permalink
)
mortisimus
The Contributor
Join Date: Sep 2007
Location: London, UK
Posts: 47
Thanks: 4
No problem!
«
Previous Thread
|
Next Thread
»
Currently Active Users Viewing This Thread: 1
(0 members and 1 guests)
Thread Tools
Search this Thread
Show Printable Version
Email this Page
Search this Thread
:
Advanced Search
Display Modes
Linear Mode
Switch to Hybrid Mode
Switch to Threaded Mode
Posting Rules
You
may not
post new threads
You
may not
post replies
You
may not
post attachments
You
may not
edit your posts
vB code
is
On
Smilies
are
On
[IMG]
code is
On
HTML code is
Off
Trackbacks
are
On
Pingbacks
are
On
Refbacks
are
On
All times are GMT. The time now is
12:09 AM
.
Contact Us
-
TalkPHP - PHP Community
-
Archive
-
Top
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by
vBSEO
3.1.0
Inactive Reminders By
Icora
Web Design
LinkBack
LinkBack URL
About LinkBacks