PHP网址转换为html img src [英] PHP url into html img src

查看:127
本文介绍了PHP网址转换为html img src的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用和Facebook的URL来插入HTML img src ..该url不是图像,这个URL(当在浏览器上打开时)重定向到图像。

 < img src =https://graph.facebook.com/274084006029120/picture?width=100/> 

这张图片无处不在显示。



然后我构建一个只重定向到 http://../image.jpg 的cover.php程序。

然后我添加HTML源代码

 < img src = https://.../cover.php/> 

在大多数浏览器和电子邮件中,此cover.php程序正常工作并显示图片。但在某些组件(编辑器)上,似乎php没有执行,图片也没有显示。



我该如何解决这个问题?或者我该如何做重定向(之前需要一些代码)才能像Facebook重定向一样工作?



非常感谢!



 头文件   ('Location:http://..../image_url'); 


i'm using and url from Facebook to insert into HTML img src .. that url is not an image, this url (when opened on a browser) redirects to an image.

 <img src="https://graph.facebook.com/274084006029120/picture?width=100" />

This image is shown correctly everywhere.

Then I build a cover.php program that only redirect to an http://../image.jpg

Then i add on HTML source

 <img src="https://.../cover.php" />

On most browsers and emails this cover.php program Works fine and shows the picture. But on some components (editors) seems the php is not executed and the picture is not show.

How can i solve this ? or how can i do redirect (need some code before) to work like Facebook redirect ?

Thanks a lot !

解决方案

You can redirect browser with adding this line to your php code:

header('Location: http://..../image_url');

这篇关于PHP网址转换为html img src的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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