ie6 - gd和php图像输出 [英] ie6 - gd and php image outputting

查看:98
本文介绍了ie6 - gd和php图像输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用灰度滤镜显示图像。这是我的代码:

i'm trying to show image with grayscale-filter. Here is my code:

$images = glob('gallery/*small*');
shuffle($images);
array_splice($images, 3);

$imgHandles = array();
$imgBuffered = array();
for( $i = 0; $i < 3; $i++)
{  
   $imgHandles[$i] = imagecreatefromstring( file_get_contents($images[$i]) ); 
   imagefilter( $imgHandles[$i], IMG_FILTER_GRAYSCALE ); 

   ob_start();
   imagepng( $imgHandles[$i] ); 
   $imgBuffered[$i] = ob_get_contents();
   ob_end_clean();
   imagedestroy( $imgHandles[$i] ); 
} 

输出:

for( $i = 0; $i < 3; $i++ )
{  
   echo "<a href=\"gallery.php\">
   <img class=\"photo\" src='data:image/png;base64,".base64_encode( $imgBuffered[$i] )."' /></a>";                                                                                    
}



在歌剧,ff,chrome,safari中一切都很好,但ie6没有' t显示图像。为什么?



我在页面上创建了代码: http://dean.edwards.name/weblog/2005/06/base64-ie/
我看到图片,但在几秒钟内他们隐藏了......我真的不知道为什么。你可以帮我解决这个问题吗?

In opera, ff, chrome, safari everything is fine, but ie6 doesn't show images. Why?

I made code like at page: http://dean.edwards.name/weblog/2005/06/base64-ie/ I see pictures, but in some seconds they hide... I really don't know why. Can you help me with this stuff?

推荐答案

数据URI方案不支持 =nofollow noreferrer>。您需要将图像保存到某处并以 img src 的形式提供保存图像的URL,或者您需要通过单独的脚本动态生成它并执行类似 img src =path / to / image_generator.php

The data URI scheme isn't supported in IE6 (nor IE7, apparently). You'll need to save the image somewhere and provide the URL to the saved image as the img src, or you'll need to generate it on the fly via a separate script and do something like img src="path/to/image_generator.php".

这篇关于ie6 - gd和php图像输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆