AddType application / x-httpd-php .png的麻烦 [英] Trouble with AddType application/x-httpd-php .png

查看:320
本文介绍了AddType application / x-httpd-php .png的麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建论坛最喜欢的动态sig图像,那是'

真正的PHP脚本。我在.php文件方面取得了一定的成功,但当我将
更改为扩展为.png时,我提示下载文件,而不是渲染文件。 。


我的理解是这不应该发生,并且通过添加an.htaccess文件来添加.htaccess文件我可以强制.png文件被编译/ PHP解析/

。在我的.htaccess文件中,我有:


AddType application / x-httpd-php .png


有什么建议吗?


我正在使用heliohost.org作为我的主机,他们基本上把我指向

创建上面的文件(作为我最近的支持查询的第一个回复)。 br />
谷歌搜索这个我没有看到我做错了什么..那么

给出了什么?

I''m trying to create the forum favorite dynamic sig image, that''s
realy PHP script. I''ve had moderate success with .php files but when I
change the extension to .png I''m prompted to download the file, rather
than it rendering.

My understanding is that this is not supposed to happen, and that by
adding an.htaccess file I can force .png files to be compiled/parsed/
whatevered by PHP. In my .htaccess file I have:

AddType application/x-httpd-php .png

Any advice?

I''m using heliohost.org as my host, and they basically pointed me to
create the above file (as the first reply to my recent support query).
Googling this I''m not seeing that I''m doing anything wrong.. so what
gives?

推荐答案

" C. (http://symcbean.blogspot.com/)" < co ************ @ gmail.comwrote在

新闻:11 ******************* **@o3g2000hsb.googlegrou ps.com:

"C. (http://symcbean.blogspot.com/)" <co************@gmail.comwrote in
news:11*********************@o3g2000hsb.googlegrou ps.com:


2)设置浏览器在标题(...)调用中使用的内容类型

你的PHP
2) set the content type for the browser to use in a header(...) call
in your PHP



这绝对是最好的选择。根本不要乱用apache,使用


< img src =" imageDisplay.php?key = 39478197">


和imageDisplay.php使用:


header(" Content-type:image / png");

that is absolutely the way to go. don''t mess with apache at all, use

<img src="imageDisplay.php?key=39478197">

and have imageDisplay.php use:

header("Content-type: image/png");


im = imagecreatefrompng(" test.png");

imagepng(
im = imagecreatefrompng("test.png");
imagepng(


im);
http://ca.php.net/manual/en/function.imagepng.php

im);
http://ca.php.net/manual/en/function.imagepng.php


这篇关于AddType application / x-httpd-php .png的麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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