本文整理匯總了PHP中ImageManager::cut方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImageManager::cut方法的具體用法?PHP ImageManager::cut怎麽用?PHP ImageManager::cut使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ImageManager
的用法示例。
在下文中一共展示了ImageManager::cut方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: imageCut
/**
* @deprecated 1.5.0
*/
function imageCut($srcFile, $destFile, $destWidth = NULL, $destHeight = NULL, $fileType = 'jpg', $destX = 0, $destY = 0)
{
Tools::displayAsDeprecated();
if (isset($srcFile['tmp_name'])) {
return ImageManager::cut($srcFile['tmp_name'], $destFile, $destWidth, $destHeight, $fileType, $destX, $destY);
}
return false;
}
示例2: import_media_img
}
public static function import_media_img($file_url, $folder, $filename)
{
// $folder = rev_media_folder();
$wpdb = rev_db_class::rev_db_instance();
copy($file_url, $folder . $filename);
$imagearray = array('file_name' => $filename);
$mysqli = $wpdb->insert($wpdb->prefix . GlobalsRevSlider::TABLE_ATTACHMENT_IMAGES, $imagearray);
$imgid = $wpdb->Insert_ID();
if (!empty($mysqli) && is_numeric($imgid)) {
//new fixing
$sizes = array(GlobalsRevSlider::IMAGE_SIZE_THUMBNAIL, GlobalsRevSlider::IMAGE_SIZE_MEDIUM, GlobalsRevSlider::IMAGE_SIZE_LARGE);
$filerealname = substr($filename, 0, strrpos($filename, '.'));
$fileext = substr($filename, strrpos($filename, '.'), strlen($filename) - strlen($filerealname));
list($width, $height) = getimagesize($folder . $filename);
$count = 0;
foreach ($sizes as $size) {
$nsize = self::get_img_aspect_ratio(array($width, $height, $size));
$newfilename = "{$filerealname}-{$size}x{$size}{$fileext}";
if (++$count > 1) {
ImageManager::resize($folder . $filename, $folder . $newfilename, $nsize[0], $nsize[1]);
} else {
$posx = $width / 2 - $size / 2;
$posy = $height / 2 - $size / 2;
ImageManager::cut($folder . $filename, $folder . $newfilename, $size, $size, substr($fileext, 1), $posx, $posy);
}
}
return array("id" => $imgid, "path" => 'uploads/' . $filename);
// return array("id" => $imgid, "path" => $filename);
}