i landed here today searching for a way to tell (via php) if a specific .png image is an alpha-png one -
David Jones answer points to the right direction, really easy to implement in php:
file_get_contents to load just that 25 byte (there it is, indeed!), and
ord() to get its ASCII value, to test it (against 6 in my case)
if(ord(file_get_contents($alpha_png_candidate, NULL, NULL, 25, 1)) == 6) {
is_alpha_png_so_do_something();
}
actually i needed that for assuring backward compatibility with ie6
within cms-user-generated-pages, to replace all alpha-png < img > tags with inline-block < spans > - the alpha-png file will then be served as variable for the ms-proprietary css property filter
.alpha_png_span{
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(
src= $alpha_png_candidate , sizingMethod= crop )
}
......所有工作都是如此。
paolo