本文整理汇总了PHP中image::width方法的典型用法代码示例。如果您正苦于以下问题:PHP image::width方法的具体用法?PHP image::width怎么用?PHP image::width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image
的用法示例。
在下文中一共展示了image::width方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($path)
{
$this->image = Image::make($path);
$this->name = $this->getUniqueName();
$this->isLandscape = $this->image->width() > $this->image->height();
// default 2:3 ratio
$this->ratioLarge = 3;
$this->ratioSmall = 2;
}
示例2: image
if ($_REQUEST['uploadType'] == 'image') {
$img = new image();
$img->createfromfile($target);
if ($img->width() > $img->height()) {
$left = ($img->width() - $img->height()) / 2;
$img->cut($left, 0, $img->height(), $img->height());
} else {
$top = ($img->height() - $img->width()) / 2;
$img->cut(0, $top, $img->width(), $img->width());
}
$img->resize(64, 64, true);
$thumbtarget = getThumbUrl($target);
$img->save($thumbtarget, 90);
$img2 = new image();
$img2->createfromfile($target);
if ($img2->width() > 640 || $img2->height() > 640) {
$img2->resize(540, 540, true);
}
$midsizetarget = getMidsizeUrl($target);
$img2->save($midsizetarget, 90);
$image['url'] = $target;
$image['dateCreated'] = date("Y-m-d H:i:s");
$image['id'] = $waka['maxImageId'];
$image['name'] = basename($_FILES['uploaded']['name']);
$item['images'][count($item['images'])] = $image;
$item['dateImagesTouched'] = date("Y-m-d H:i:s");
}
}
} else {
echo "Sorry, there was a problem uploading your file.";
}