导航:首页 > 源码编译 > php图片压缩网站源码

php图片压缩网站源码

发布时间:2025-04-07 16:09:42

‘壹’ php写的json接口如何将图片压缩

用imageresized()缩放,图片就小了,或者采用base64压缩~

‘贰’ 如何利用php把上传的图片压缩

<?php
//Thefile
$filename='test.jpg';
$percent=0.5;

//Contenttype
header('Content-Type:image/jpeg');

//Getnewdimensions
list($width,$height)=getimagesize($filename);
$new_width=$width*$percent;
$new_height=$height*$percent;

//Resample
$image_p=imagecreatetruecolor($new_width,$new_height);
$image=imagecreatefromjpeg($filename);
imageresampled($image_p,$image,0,0,0,0,$new_width,$new_height,$width,$height);

//Output
imagejpeg($image_p,null,100);
?>

http://php.net/manual/en/function.imageresampled.php

阅读全文

与php图片压缩网站源码相关的资料

热点内容
高新区编程加盟找哪家 浏览:22
服务器什么样的好卖 浏览:140
单片机原理及应用第二版例题答案 浏览:960
base64encoderjava 浏览:482
linux视频转换 浏览:694
linux与unixshell编程指南 浏览:133
vb6反编译程序错误 浏览:121
服务器弄挂有什么影响 浏览:302
安卓软件为什么运行不了 浏览:526
什么安卓手机是四方的 浏览:477
云服务器厂商租用多少钱 浏览:353
平安车贷解压要多久 浏览:416
乐一php程序员待遇 浏览:164
ZDM命令无法识别 浏览:922
解压小手工A4纸 浏览:983
钢筋加密区是几倍 浏览:671
编译程序代码软件 浏览:808
怎么恢复加密的东西 浏览:989
程序员卖茶 浏览:700
后端程序员英文 浏览:365