‘壹’ php 读取图片并输出
<?php
header('Content-Type:image/png');
$url="http://hbyw.e21.e.cn/global/gd.php";//图片链接
$ch=curl_init();
//Cookie:PHPSESSID=
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_COOKIE,'PHPSESSID=');//如果不需要cookies就删除这条语句
curl_setopt($ch,CURLOPT_RETURNTRANSFER,0);
curl_setopt($ch,CURLOPT_TIMEOUT,0);//忽略超时
curl_setopt($ch,CURLOPT_NOBODY,false);
$str=curl_exec($ch);
curl_close($ch);
‘贰’ php中怎么输出图片
<divclass="flexslider">
<ulclass="slides">
<?php
if($info->tupian==""){
echo"暂无图片";
}
else
{
echo"<lidata-thumb='".$info->tupian."'><divclass='thumb-image'><imgsrc='".$info->tupian."'data-imagezoom='true'class='mg-responsive'></div></li>";
}
?>
</ul>
</div>
‘叁’ html 中如何用php输出图片
把图片地址用php代码来代替就可以了。比如原本图片地址是<img src="images/1.jpg" />,数据库保存的是images/1.jpg,字段名是”images“。那么这边就改成<img src="<?php $row=['images']?>" />。
‘肆’ php怎么输出背景透明的图片
php可以使用GD库或者ImageMagick工具生成png或者gif的背景透明图片.推荐使用ImageMagick.
这里有范例 http://php.net/manual/en/imagick.examples-1.php
准备一张png图片,放到php文件的目录,运行看看效果.
<?php
/* Read the image */
$im = new Imagick("test.png");
/* Thumbnail the image */
$im->thumbnailImage(200, null);
/* Create a border for the image */
$im->borderImage(new ImagickPixel("white"), 5, 5);
/* Clone the image and flip it */
$reflection = $im->clone();
$reflection->flipImage();
/* Create gradient. It will be overlayed on the reflection */
$gradient = new Imagick();
/* Gradient needs to be large enough for the image and the borders */
$gradient->newPseudoImage($reflection->getImageWidth() + 10, $reflection->getImageHeight() + 10, "gradient:transparent-black");
/* Composite the gradient on the reflection */
$reflection->compositeImage($gradient, imagick::COMPOSITE_OVER, 0, 0);
/* Add some opacity. Requires ImageMagick 6.2.9 or later */
$reflection->setImageOpacity( 0.3 );
/* Create an empty canvas */
$canvas = new Imagick();
/* Canvas needs to be large enough to hold the both images */
$width = $im->getImageWidth() + 40;
$height = ($im->getImageHeight() * 2) + 30;
$canvas->newImage($width, $height, new ImagickPixel("black"));
$canvas->setImageFormat("png");
/* Composite the original image and the reflection on the canvas */
$canvas->compositeImage($im, imagick::COMPOSITE_OVER, 20, 10);
$canvas->compositeImage($reflection, imagick::COMPOSITE_OVER, 20, $im->getImageHeight() + 10);
/* Output the image*/
header("Content-Type: image/png");
echo $canvas;
?>
‘伍’ php怎么输出图片
首先设置头部
header("Content-type: image/png");
然后创建图片等操作
最后输出:
imagepng($im,"1.png");
‘陆’ 怎样用PHP将MySQL中的图片的路径输出为图片
<?php
$result=mysql_query('select 图片路径字段名,书名字段名,简介字段名 from 表名');
while($row=mysql_fetch_array($result)){
//输出图片,注意echo用“" "”,图片的路径就得用“' '”,再在路径里写变量,就得用“".变量名."”
echo "<p><img src='".$row[0]."' /></p>";
//输出书名,这里用“'.变量名.'”下一行输出简介
echo "<p>'.$row[1].'</p>";
echo "<p>'.$row[2].'</p>";
//因为上面的select语句写出了字段名,只要第一个用“0”,第二个用“1”代写就好了
}
?>
‘柒’ thinkPHP怎样输出图片
查询数据库获取图片的路径,分配到模板上就行
‘捌’ PHP中GD库如何将图片输出至页面
你想得太复杂了一点点。。
<img src="x.php" />
这样就可以了
<?php
//x.php
$abc=new abc(); //不知道你类名是什么
$abc->createPNG();
?>
记得不要有别的东西 echo 就行了。
‘玖’ PHP怎么输出图片啊我的图片1.jpg和new.php在同一位置为什么图片不能显示
new.php里面如下的语句输出1.jpg:
<?php
echo
"<img
src='1.jpg'>";
?>
你可以单独把以上语句存为一个PHP文件试试看,如果成功了,说明没有其它问题,可能是你的1.jpg的实际名字中有空格或者引号等特殊符号,或者名字含有中文而PHP文件是UTF编码,这样就会造成找不到文件,改为1.JPG试试看。
如果文件名确实是1.JPG,而且是上面的单独的PHP文件,仍然无法显示,可以在浏览器图片的红叉上点鼠标右键查看属性,看看显示的网址,检查是不是指向了你希望的文件夹位置。
‘拾’ PHP怎么显示出图片
不要用记事本直接编辑PHP文件,因为可能会存在bom头信息,导致图片不能正常显示,你可以自行网络bom头信息,建议使用编辑器notepad++,可以去除文件bom头,图片就会正常显示