導航:首頁 > 動漫圖片 > php怎麼輸出圖片

php怎麼輸出圖片

發布時間:2023-01-22 21:53:47

『壹』 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頭,圖片就會正常顯示

閱讀全文

與php怎麼輸出圖片相關的資料

熱點內容
電腦上如何添加圖片格式 瀏覽:99
高貴女人動漫圖片 瀏覽:480
美女什麼也沒有穿的圖片 瀏覽:584
小額貸款文字圖片 瀏覽:816
便簽如何去掉圖片 瀏覽:255
潮牌可愛圖片 瀏覽:167
雙龍銀幣價格及圖片 瀏覽:779
如何將圖片png格式轉換成jpg 瀏覽:252
淘寶簽收圖片怎麼保存 瀏覽:991
古代女生側顏真人圖片 瀏覽:791
精選網紅圖片唯美男生 瀏覽:284
動漫男孩圖片紋身 瀏覽:643
word文件咋插入身份證圖片 瀏覽:484
大麥文字手寫圖片 瀏覽:933
衣服太多圖片文字 瀏覽:286
我姓師的文字圖片 瀏覽:883
男生漂亮手寫字圖片 瀏覽:368
抓馬圖片高清 瀏覽:486
word圖片文字不清晰怎麼處理 瀏覽:616
衣服鞋子搭配圖片男士 瀏覽:712