function ecstart_convert_jpeg(
$src_file,$dst_file,$text_type,$text_image,$watermark_type,$watermark_image,$pic_width,
$pic_height){
//$src_file 來源圖片路徑
//$dst_file 存檔圖片路徑
//$text_type 是否插入文字
//$text_image 插入的文字內容
//$watermark_type 是否插入浮水印
//$watermark_image 圖水印圖片路徑
//$pic_width 存檔圖片寬度
//$pic_height 存檔圖片高度
$image = imagecreatefromjpeg($src_file) ;
$s_width = imagesx($image);
$s_height = imagesy($image);
// 縮圖大小
$thumb = imagecreatetruecolor($pic_width, $pic_height);
// 自動縮圖
imagecopyresized($thumb, $image, 0, 0, 0, 0, $pic_width, $pic_height, $s_width, $s_height);
//imagejpeg($thumb,"/tmp/tmpfile.jpg","100");
//$thumbimage = imagecreatefromjpeg("/tmp/tmpfile.jpg") ;
// 取得寬度
$i_width = imagesx($thumb);
$i_height = imagesy($thumb);
//imagejpeg($image,"/home/www/ecstart.com/public_html/cart/test.jpg","100");
//imagejpeg($image);
// 計算 插入文字出現位置
$ywpos = $i_height - 35 ;
// 設定 插入文字
$textcolor = imagecolorallocate($thumb, 250, 250, 250);
// 插入文字
if($text_type == "Y"){
imagestring($thumb, 5, 25, $ywpos, $text_image, $textcolor);
}
// 載入浮水印圖
$w_image = imagecreatefromjpeg($watermark_image) ;
// 取出浮水印圖 寬 與 高
$w_width = imagesx($w_image);
$w_height = imagesy($w_image);
// 計算 浮水印出現位置
$xpos = $i_width - $w_width -20 ;
$ypos = $i_height - $w_height-20 ;
//結合浮水印
if($watermark_type == "Y"){
imagecopy($thumb,$w_image,$xpos,$ypos,0,0,$w_width,$w_height);
}
imagejpeg($thumb,$dst_file,"100");
imagedestroy($thumb);
imagedestroy($image);
imagedestroy($w_image);
}
公告版位
礁溪溫泉套房,位於宜蘭縣礁溪國小旁,近麥當勞,離礁溪火車站、首都客運、葛瑪蘭汽車客運約5分鍾車程,礁溪溫泉套房出租,您不需要再行添購傢俱,只需要帶幾件衣服,就能輕輕鬆鬆住進礁溪溫泉套房,天天在礁溪溫泉套房洗溫泉唷!意洽:游媽媽,電話0939711360,4500~4900元/月
- Aug 10 Wed 2016 10:43
[php]自動縮圖 , 插入文字 , 插入浮水印
- Aug 10 Wed 2016 10:25
[php]imagecopy 拷貝圖像的一部分(裁圖)
- Aug 10 Wed 2016 10:11
[php]imageconvolution 用系數 div 和 offset 申請一個 3x3 的卷積矩陣
- Aug 10 Wed 2016 10:08
[php]imagecolortransparent — 將某個顏色定義為透明色
- Aug 10 Wed 2016 10:04
[php]imagecolorstotal 取得一幅圖像的調色板中顏色的數目
- Aug 09 Tue 2016 10:54
[php]imagecolorsforindex 取得某索引的顏色
- Aug 09 Tue 2016 10:52
[php]imagecolorset 給指定調色板索引設定顏色
- Aug 09 Tue 2016 10:49
[php]imagecolorresolvealpha 取得指定顏色 + alpha 的索引值或有可能得到的最接近的替代值
- Aug 09 Tue 2016 10:47
[php]imagecolormatch 使一個圖像中調色板版本的顏色與真彩色版本更能匹配
- Aug 08 Mon 2016 14:37
[php]imagecolorexactalpha 取得指定的顏色加透明度的索引值
- Aug 08 Mon 2016 14:32
[php]imagecolorexact 取得指定顏色的索引值
- Aug 08 Mon 2016 14:29
[php]imagecolorclosesthwb 取得與給定顏色最接近的色度的黑白色的索引
- Aug 08 Mon 2016 14:27
[php]imagecolorclosestalpha 取得與指定的顏色加透明度最接近的顏色
- Aug 05 Fri 2016 10:43
[php]curl_version 獲取cURL版本信息
- Aug 05 Fri 2016 10:42
[php]curl_unescape() 解碼URL編碼後的字符串
- Aug 05 Fri 2016 10:41
[php]curl_strerror() 返回錯誤代碼的字符串描述
- Aug 05 Fri 2016 09:11
[php]curl_share_setopt() 設置一個共享句柄的cURL傳輸選項
- Aug 05 Fri 2016 09:07
[php]curl_share_init() 初始化cURL共享句柄。
- Aug 05 Fri 2016 09:06
[php]curl_share_close() 關閉cURL共享句柄
- Aug 04 Thu 2016 09:35
[php]curl_setopt 設置一個cURL傳輸選項
- Aug 04 Thu 2016 09:26
[php]curl_setopt_array() 為cURL傳輸會話批量設置選項
- Aug 04 Thu 2016 09:23
[php]curl_reset 重置libcurl的會話句柄的所有選項
- Aug 04 Thu 2016 09:19
[php]curl_multi_strerror 返回描述錯誤碼的字符串文本
- Aug 04 Thu 2016 09:14
[php]curl_multi_remove_handle 移除curl批處理句柄資源中的某個句柄資源
- Aug 03 Wed 2016 14:22
[php]curl_multi_init 返回一個新cURL批處理句柄