本文整理匯總了PHP中Picture::toFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP Picture::toFile方法的具體用法?PHP Picture::toFile怎麽用?PHP Picture::toFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Picture
的用法示例。
在下文中一共展示了Picture::toFile方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: cacheIt
public function cacheIt($width = null, $height = null, $mode = 'equal')
{
$w = isset($width) ? $width : $this->m_width;
$h = isset($height) ? $height : $this->m_height;
$p = new Picture($this->m_filename);
if ($w == null && $h == null) {
$mode = 'equal';
}
$search_filename = Picture::getPictureFilename($this->m_filename, $w, $h, $mode);
if (!file_exists($search_filename)) {
switch ($mode) {
case 'redim':
$p->dimensionTo($w, $h);
break;
case 'crop':
$p->cropTo($w, $h);
break;
}
$p->toFile($search_filename);
}
if (file_exists($search_filename)) {
list($width, $height, $type, $attr) = getimagesize($search_filename);
return array('width' => $width, 'height' => $height);
}
}