开发者

Load remote favicon and then convert to png with PHP before loading into AS3

开发者 https://www.devze.com 2022-12-19 13:59 出处:网络
As of now I am using cURL to load a remote favicon, but it outputs it as a .ICO, which AS3 will not load. I tried to convert the .ICO with imagepng, but that caused errors. Is there a way I can load a

As of now I am using cURL to load a remote favicon, but it outputs it as a .ICO, which AS3 will not load. I tried to convert the .ICO with imagepng, but that caused errors. Is there a way I can load a remote favicon and convert it to a png with PHP before loading it into AS3 without relying on Google's s2?

Some of the code:

snip

$imagestring = curl_exec($ch);
$image = imagecreatefromstring($image);
curl_close($ch);
header("Content-Type: image/png");
imag开发者_Go百科epng($image);
imagedestroy($image);

snip


GD doesn't support the ICO image format. However, somewhere inside the ICO file should be valid BMP file - once you strip out the ICO format stuff, you should be able to load what's left via imagecreatefromstring().

To help you along the way, you can find more information about the ICO format on this wikipedia page.

0

精彩评论

暂无评论...
验证码 换一张
取 消