1
我有这个图像www.site.com/folder1/image1.jpg
,我想要做的是从一个变量访问我的图像,例如www.site.com/image.php?q=varForImage1
,它需要使用<img>
标签。
例子:
<img scr="www.site.com/image.php?q=varForImage1">
图像url使用变量
任何帮助吗?
感谢
我有这个图像www.site.com/folder1/image1.jpg
,我想要做的是从一个变量访问我的图像,例如www.site.com/image.php?q=varForImage1
,它需要使用<img>
标签。
例子:
<img scr="www.site.com/image.php?q=varForImage1">
图像url使用变量
任何帮助吗?
感谢
<?php
// define $image_path as required
$image_path;
header('Content-type:'.mime_content_type($image_path));
echo file_get_contents($image_path);
die();
事情是这样的:
<?php
$image = $_GET['q'];
$file = fopen('/path/to/'.$image, 'rb');
header("Content-Type: image/png");
那么,你应该提高,当然代码,它可能只是给你一个想法。
你想达到什么目的?我的意思是,你为什么这么想? –
这是一个PHP或JavaScript变量? – tymeJV
要隐藏图片url – Xriuk