gifphp
㈠ php如何獲取gif圖第一幀 像圖上那樣點下gif會播放
都是先在後天把gif處理成jpg,然後前端默認顯示jpg,點擊jpg後,用javascript把src換成gif的路徑。
㈡ html php gif jpg winrar是什麼意思
GIF,JPG是圖像格式,兩者都經過壓縮處理,其中GIF支持透明,JPG很普通,兩者在網頁中使用廣泛,但隨著PNG格式的到來,因其GIF支持透明但沒有透明過度效果,比如GIF圖片要麼是全透明的,要麼就是不透明的,PNG恰恰擁有了GIF沒有的功能還有高度的壓縮率越來越被網站開發者應用
WINrar是壓縮軟體,RAR是其壓縮處理後的壓縮包,可以到網上搜索壓縮軟體
HTML是靜態網頁的擴展名,現在主要配合CSS使用,可以在網上搜索HTML,XHTML(DIV+CSS),還有HTML5
PHP是動態網頁擴展名,因是開源免費,在動態網站上用應很多,如各大論壇,購物網站……,它是伺服器端腳本程序,所以要配合HTML前台頁面,因此HTML是網站入門必學的技術,HTML,css對PHP程序員來說已經不是技術了
以上是個人觀點有錯誤請廣大知友指正
㈢ php到底支持還是不支持生成會動的gif圖片
你沒有GD2的支持想用PHP生成圖片你就別開玩笑了..首先phpinfo();看看伺服器支持不支持GD2 如果支持的話就可以開始做了 <?php function resizeImage($im,$maxwidth,$maxheight,$name,$filetype) { $pic_width = imagesx($im); $pic_height = imagesy($im); if(($maxwidth && $pic_width > $maxwidth) || ($maxheight && $pic_height > $maxheight)) { if($maxwidth && $pic_width>$maxwidth) { $widthratio = $maxwidth/$pic_width; $resizewidth_tag = true; } if($maxheight && $pic_height>$maxheight) { $heightratio = $maxheight/$pic_height; $resizeheight_tag = true; } if($resizewidth_tag && $resizeheight_tag) { if($widthratio<$heightratio) $ratio = $widthratio; else $ratio = $heightratio; } if($resizewidth_tag && !$resizeheight_tag) $ratio = $widthratio; if($resizeheight_tag && !$resizewidth_tag) $ratio = $heightratio; $newwidth = $pic_width * $ratio; $newheight = $pic_height * $ratio; if(function_exists("imageresampled")) { $newim = imagecreatetruecolor($newwidth,$newheight); imageresampled($newim,$im,0,0,0,0,$newwidth,$newheight,$pic_width,$pic_height); } else { $newim = imagecreate($newwidth,$newheight); imageresized($newim,$im,0,0,0,0,$newwidth,$newheight,$pic_width,$pic_height); } $name = $name.$filetype; imagejpeg($newim,$name); imagedestroy($newim); } else { $name = $name.$filetype; imagejpeg($im,$name); } } function() ?> 上面是一個做水印的例子...其他的函數的話自己各異查手冊. 最後告訴你想生成Gif圖片可以, 想讓它動好像不能
希望點贊
㈣ php 如何讓gif動圖轉換為gif靜圖
以下是一個縮略圖生成程序,我加了注釋,動態gif動畫處理後就變成靜態了,程序還可以加水印,當然傳參你留空就不會加了。使用有困難的話給我留言。
-----------------------------
/*構造函數-生成縮略圖+水印,參數說明:$srcFile-圖片文件名,$dstFile-另存文件名,$markwords-水印文字,$markimage-水印圖片,$dstW-圖片保存寬度,$dstH-圖片保存高度,$rate-圖片保存品質*/
function makethumb($srcFile,$dstFile,$dstW,$dstH,$rate=100,$markwords=null,$markimage=null)
{
$data = GetImageSize($srcFile);
switch($data[2])
{
case 1:
$im=@ImageCreateFromGIF($srcFile);
break;
case 2:
$im=@ImageCreateFromJPEG($srcFile);
break;
case 3:
$im=@ImageCreateFromPNG($srcFile);
break;
}
if(!$im) return False;
$srcW=ImageSX($im);
$srcH=ImageSY($im);
$dstX=0;
$dstY=0;
if ($srcW*$dstH>$srcH*$dstW)
{
$fdstH = round($srcH*$dstW/$srcW);
$dstY = floor(($dstH-$fdstH)/2);
$fdstW = $dstW;
}
else
{
$fdstW = round($srcW*$dstH/$srcH);
$dstX = floor(($dstW-$fdstW)/2);
$fdstH = $dstH;
}
$ni=ImageCreateTrueColor($dstW,$dstH);
$dstX=($dstX<0)?0:$dstX;
$dstY=($dstX<0)?0:$dstY;
$dstX=($dstX>($dstW/2))?floor($dstW/2):$dstX;
$dstY=($dstY>($dstH/2))?floor($dstH/s):$dstY;
$white = ImageColorAllocate($ni,255,255,255);
$black = ImageColorAllocate($ni,0,0,0);
imagefilledrectangle($ni,0,0,$dstW,$dstH,$white);// 填充背景色
ImageCopyResized($ni,$im,$dstX,$dstY,0,0,$fdstW,$fdstH,$srcW,$srcH);
if($markwords!=null)
{
$markwords=iconv("gb2312","UTF-8",$markwords);
//轉換文字編碼
ImageTTFText($ni,20,30,450,560,$black,"simhei.ttf",$markwords); //寫入文字水印
//參數依次為,文字大小|偏轉度|橫坐標|縱坐標|文字顏色|文字類型|文字內容
}
elseif($markimage!=null)
{
$wimage_data = GetImageSize($markimage);
switch($wimage_data[2])
{
case 1:
$wimage=@ImageCreateFromGIF($markimage);
break;
case 2:
$wimage=@ImageCreateFromJPEG($markimage);
break;
case 3:
$wimage=@ImageCreateFromPNG($markimage);
break;
}
image($ni,$wimage,500,560,0,0,88,31); //寫入圖片水印,水印圖片大小默認為88*31
imagedestroy($wimage);
}
ImageJpeg($ni,$dstFile,$rate);
ImageJpeg($ni,$srcFile,$rate);
imagedestroy($im);
imagedestroy($ni);
}
?>
㈤ php 如何將GIF動態圖像縮放成指定大小後依舊保持動態
此js代碼來自網路logo的處理,還是很好用的,需要注意的地方就是proMaxHeight,proMaxWidth參數的動態獲取,你可以直接用php賦值,或者用smartyphplib之類的模板,這個不難
<htmlxmlns="http://www.w3.org/1999/xhtml"xml:lang="zh-CN"lang="zh-CN">
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>
<title>test</title>
<scriptlanguage=Javascript>
varproMaxHeight=50;
varproMaxWidth=50;
functionproDownImage(ImgD){
varimage=newImage();
image.src=ImgD.src;
if(image.width>0&&image.height>0){
varrate=(proMaxWidth/image.width<proMaxHeight/image.height)?proMaxWidth/image.width:proMaxHeight/image.height;
if(rate<=1){
ImgD.width=image.width*rate;
ImgD.height=image.height*rate;
}
else{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
}
//-->
</script>
</head>
<bodybgcolor="#ffffff"topmargin="0"leftmargin="0"scroll="no">
<imgsrc="./pp.gif"onload=proDownImage(this);/>
</body>
</html>
㈥ 怎麼用PHP壓縮GIF圖
縮圖小軟體ImageResizerPowertoys
微軟出品的免費縮圖小軟體,它不但能夠快速、批量地縮小圖片,而且操作超級簡單。安裝結束後,它會在你的滑鼠右鍵菜單中嵌入一個"ResizePicture"項。在圖片文件上點右鍵選這個"ResizePicture"即可設置你希望縮小的圖片尺寸。
JPEG Imager 2.1.2.25 漢化版
JPEG Imager 能將 BMP、JPG、PNG、GIF 等格式的圖形文件進行壓縮,使文件變得更小,可自設壓縮比例、大小、明暗度等等,它採用了一種新壓縮演算法:「智能過濾(smart filtration)」不僅可以改善圖像的觀感質量,而且還可為輸出的圖片「減肥」,允許壓縮後的圖形文件不失真。還可以建立類似於漸變 GIF 效果的漸變式 JPEG 圖像,這種形式的 JPEG 圖像應用於網頁製作可使網頁讀取的速度加快。它的特點還包括對圖像進行批量處理高效建立縮略圖以及利用自帶的濾鏡、圖像編輯器對圖形進行簡單的處理等。
㈦ php中對gif怎麼支持
如果是一個gif動畫不能動了,和php沒關,裝個新的ie試試,
要是想生成個gif圖片,要下個gd庫才行,
㈧ 我的網站images總是被傳入gifimg.php文件,然後整站被掛碼
很難說 我一般掛都是....jpg 把網站漏洞補上 然後改後台密碼
㈨ 如何用php把gif分解成一幀一幀的
GifFrameExtractor is really easy to use:
1 - Extraction:
$gifFilePath = 'path/images/picture.gif';
if (GifFrameExtractor::isAnimatedGif($gifFilePath)) { // check this is an animated GIF
$gfe = new GifFrameExtractor();
$gfe->extract($gifFilePath);
// Do something with extracted frames ...
}
2 - Getting the frames and their ration:
foreach ($gfe->getFrames() as $frame) {
// The frame resource image var
$img = $frame['image'];
// The frame ration
$ration = $frame['ration'];
}
You can also get separately an array of images and an array of rations:
$frameImages = $gfe->getFrameImages();
$frameDurations = $gfe->getFrameDurations();
Option:
You can choose if you want to get the original frames (with transparency background) or frames pasted on the first one with the second parameter of extract() method:
$gfe->extract('path/images/picture.gif', true); // Can get transparency orignal frames
This option is false by default.
About
The class reuses some part of code of "PHP GIF Animation Resizer" by Taha PAKSU (thanks to him).