本文整理汇总了PHP中gcms::resizeImage方法的典型用法代码示例。如果您正苦于以下问题:PHP gcms::resizeImage方法的具体用法?PHP gcms::resizeImage怎么用?PHP gcms::resizeImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gcms
的用法示例。
在下文中一共展示了gcms::resizeImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
} else {
// อัปโหลดรูปภาw
if ($file['tmp_name'] != '') {
// ตรวจสอบไฟล์อัปโหลด
$info = gcms::isValidImage($config['gallery_image_type'], $file);
if (!$info) {
$ret['ret_gallery_pic'] = 'INVALID_FILE_TYPE';
$input = 'gallery_pic';
$error = 'INVALID_FILE_TYPE';
} elseif (!gcms::testDir(DATA_PATH . "gallery/{$index['id']}/")) {
$ret['ret_gallery_pic'] = 'DO_NOT_UPLOAD';
$input = 'gallery_pic';
$error = 'DO_NOT_UPLOAD';
} else {
// อัปโหลดรูปภาพจริง
$res = gcms::resizeImage($file['tmp_name'], DATA_PATH . "gallery/{$index['id']}/", "0.{$info['ext']}", $info, $config['gallery_image_w']);
if (!$res) {
$ret['ret_gallery_pic'] = 'DO_NOT_UPLOAD';
$input = 'gallery_pic';
$error = 'DO_NOT_UPLOAD';
} else {
$save2['image'] = $res['name'];
}
// อัปโหลด thumbnail
if (!gcms::cropImage($file['tmp_name'], DATA_PATH . "gallery/{$index['id']}/thumb_{$save2['image']}", $info, $config['gallery_thumb_w'], $config['gallery_thumb_h'])) {
$ret['ret_gallery_pic'] = 'DO_NOT_UPLOAD';
$input = 'gallery_pic';
$error = 'DO_NOT_UPLOAD';
}
// ลบไฟล์เดิม
if (!empty($index['image']) && $save2['image'] != $index['image']) {
示例2: foreach
$save['last_update'] = $mmktime;
$save['count'] = (int) $index['count'] + 1;
// path เก็บไฟล์
$dir = DATA_PATH . "gallery/{$save['album_id']}/";
foreach ($_FILES as $file) {
// ตรวจสอบไฟล์อัปโหลด
$info = gcms::isValidImage($config['gallery_image_type'], $file);
if (!$info) {
$ret['error'] = 'INVALID_FILE_TYPE';
} else {
while (is_file($dir . "{$save['count']}.{$info['ext']}")) {
$save['count']++;
}
$save['image'] = "{$save['count']}.{$info['ext']}";
// อัปโหลดรูปภาพจริง
$res = gcms::resizeImage($file['tmp_name'], $dir, $save['image'], $info, $config['gallery_image_w']);
if (!$res) {
$ret['error'] = 'DO_NOT_UPLOAD';
} else {
$save['image'] = $res['name'];
}
// อัปโหลด thumbnail
if (!gcms::cropImage($file['tmp_name'], $dir . "thumb_{$save['image']}", $info, $config['gallery_thumb_w'], $config['gallery_thumb_h'])) {
$ret['error'] = 'DO_NOT_UPLOAD';
} else {
// บันทึกลง db
$db->add(DB_GALLERY, $save);
}
}
}
// อัปเดทจำนวนรูปภาพในอัลบัม