I am looking for php script that convert .png file to .icns file for mac.
Thanks.
I am looking for php script that convert .png file to .icns file for mac.
Thanks.
You can use imagemagick if available:
$im = new imagick( '/path/to/file.png' );
$im->setCompressionQuality(100);
$im->setImageFormat('icns');
$im->writeImage('/path/to/new/file.icns');
$im->clear();
$im->destroy();
Find out if you have imagemagick, with phpinfo
Apparently imagemagick does not support icns out of the box (I am sure I used it before, but maybe with some additional library? Cannot remember)
However, just tested the little Linux too icnsutils. It does not have PHP-bindings, so you will need to issue a system call (the horror)
Be vary wary of using variables whom you cannot entirely trust, in system calls. :)