添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Authentication Services
Command Line Specific Extensions
Compression and Archive Extensions
Cryptography Extensions
Database Extensions
Date and Time Related Extensions
File System Related Extensions
Human Language and Character Encoding Support
Image Processing and Generation
Mail Related Extensions
Mathematical Extensions
Non-Text MIME Output
Process Control Extensions
Other Basic Extensions
Other Services
Search Engine Extensions
Server Specific Extensions
Session Extensions
Text Processing
Variable and Type Related Extensions
Web Services
Windows Only Extensions
XML Manipulation
GUI Extensions
Keyboard Shortcuts
?
This help
Next menu item
Previous menu item
Previous man page
Next man page
Scroll to bottom
Scroll to top
Goto homepage
Goto search
(current page)
Focus search box
bernie at dakotanetwork dot com
12 years ago
create a favicon.ico with multiple resolutions

<?php

$src_img
= new Imagick ( "src_img.png" );
$icon = new Imagick ();
$icon -> setFormat ( "ico" );

$geo = $src_img -> getImageGeometry ();

$size_w = $geo [ 'width' ];
$size_h = $geo [ 'height' ];

if (
128 / $size_w * $size_h > 128 ) {
$src_img -> scaleImage ( 128 , 0 );
} else {
$src_img -> scaleImage ( 0 , 128 );
}

$src_img -> cropImage ( 128 , 128 , 0 , 0 );

$clone = $src_img -> clone ();
$clone -> scaleImage ( 16 , 0 );
$icon -> addImage ( $clone );

$clone = $src_img -> clone ();
$clone -> scaleImage ( 32 , 0 );
$icon -> addImage ( $clone );

$clone = $src_img -> clone ();
$clone -> scaleImage ( 64 , 0 );
$icon -> addImage ( $clone );

$clone = $src_img -> clone ();
$clone -> scaleImage ( 128 , 0 );
$icon -> addImage ( $clone );

$icon -> writeImages ( "favicon.ico" , true );

$src_img -> destroy ();
$icon -> destroy ();
$clone -> destroy ();

?>