PHP上传自动生成缩略图及水印类(2)
来源:互联网 责任编辑:栏目编辑 发表时间:2013-07-01 23:02 点击:次
function getInfo(photo) {
photo = this->annexFolder."/".photo;
imageInfo = getimagesize(photo);
imgInfo["width"] = imageInfo[0];
imgInfo["height"] = imageInfo[1];
imgInfo["type"] = imageInfo[2];
imgInfo["name"] = basename(photo);
return imgInfo;
}
function smallImg(photo,width=128,height=128) {
imgInfo = this->getInfo(photo);
photo = this->annexFolder."/".photo;//获得图片源
newName = substr(imgInfo["name"],0,strrpos(imgInfo["name"], "."))."_thumb.jpg";//新图片名称
if(imgInfo["type"] == 1) {
img = imagecreatefromgif(photo);
} elseif(imgInfo["type"] == 2) {
img = imagecreatefromjpeg(photo);
} elseif(imgInfo["type"] == 3) {
img = imagecreatefrompng(photo);
} else {
img = &
相关新闻>>
- 发表评论
-
- 最新评论 更多>>