Top
Navigation
I'm talking about
Last bookmarks...
mardi
26janv.2010

Imagick PHP - Optimizing PNG gotchas...

I think this deserves to be shared:

If you are generating PNG images using the Imagick extension, you might notice that your PNG files might end up beeing very very big.

I don't know exactly why, but it all RGB channels defaults to 8 bits for some reason, even if you set the image depth to 8.

So here is the solution to gain 66% of your PNG.

Just before sending the img to the client, do:

$img->setImageDepth(8);
$img->setImageChannelDepth(imagick::CHANNEL_RED, 4);
$img->setImageChannelDepth(imagick::CHANNEL_GREEN, 4);
$img->setImageChannelDepth(imagick::CHANNEL_BLUE, 4);

lundi
18janv.2010

iPhone SDK gotchas #3 - NSDictionnary and BOOL

Long time no see :)

Just a quick post to share another "strange" issue with the iPhone SDK.

Before 3.1.2, you could add a BOOL to an NSDictionnary and for some reason, it didn't crash (as it should).

Since 3.1.2, you still can add, and it still won't crash if it's YES, but it will if it's NO. Go figure :)

I learned it the hard way from my iTunes Connect crash report...

mardi
27oct.2009

IE suck... again :)

Do you know why this code fails in IE (no matter which version: 6, 7, 8):

<script> window.open(url, 'window-' + Math.rand(), 'menubars=no, toolbar=no'); </script>

Well...

Because you can't use a dash (-) in a window name stupid (and neither can you use a dot (.)) ! :)

Fwi, the w3c state that a window name is a DOMString, and the definition of DOMString is http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-C74D1578 where dashes and dots are allowed..