當前位置: 首頁>>代碼示例>>PHP>>正文


PHP upload::resizeImage方法代碼示例

本文整理匯總了PHP中upload::resizeImage方法的典型用法代碼示例。如果您正苦於以下問題:PHP upload::resizeImage方法的具體用法?PHP upload::resizeImage怎麽用?PHP upload::resizeImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在upload的用法示例。


在下文中一共展示了upload::resizeImage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: elseif

             continue;
         }
     }
 }
 if (!$imgUp->finish_upload(isset($admin_upload) ? 1 : null)) {
     if ($imgUp->error_code == 125) {
         user_feedback('error', '<b>' . $imgUp->info['full_name'] . '</b> ' . _T("site_upload_err") . ' .', 'filemove');
     }
     continue;
 }
 //Resize image if needed
 if ($settings['SET_RESIZE_IMG_ON']) {
     if (isset($_POST['new_width'][$i]) && !empty($_POST['new_width'][$i]) || isset($_POST['new_height'][$i]) && !empty($_POST['new_height'][$i])) {
         $imgUp->stretchSmallImages(true);
         if (!empty($_POST['new_width'][$i]) && !empty($_POST['new_height'][$i])) {
             $imgUp->resizeImage($_POST['new_width'][$i], $_POST['new_height'][$i], 'exact');
         } elseif (!empty($_POST['new_width'][$i]) && empty($_POST['new_height'][$i])) {
             $imgUp->resizeImage($_POST['new_width'][$i], $imgUp->info['width'], 'landscape');
         } elseif (empty($_POST['new_width'][$i]) && !empty($_POST['new_height'][$i])) {
             $imgUp->resizeImage($imgUp->info['height'], $_POST['new_height'][$i], 'portrait');
         }
         $imgUp->saveImage($imgUp->info['address'], 100, null, true);
         $imgUp->info['size'] = filesize($imgUp->info['address']);
         // get new image file size
         $imgUp->stretchSmallImages(false);
         // set it back to false
     }
 }
 // check for theme Settings
 $THUMB_OPTION = theme_setting('thumb_option', $THUMB_OPTION);
 $THUMB_MAX_WIDTH = theme_setting('thumb_max_width', $THUMB_MAX_WIDTH);
開發者ID:xctcc,項目名稱:congtu,代碼行數:31,代碼來源:upload.php

示例2:

	//Image Locations
	$large_image_location = $upload_path . $large_image_name . $file_ext;
	$thumb_image_location = $upload_path . $thumb_image_name . $file_ext;
	
	//Everything is ok, so we can upload the image.
	if (isset($_FILES['image']['name'])){
		move_uploaded_file($userfile_tmp, $large_image_location);
		chmod($large_image_location, 0777);
		
		$width = $upload->getWidth($large_image_location);
		$height = $upload->getHeight($large_image_location);
		//Scale the image if it is greater than the width set above
		if ($width > $max_width) {
			$scale = $max_width / $width;
			$uploaded = $upload->resizeImage($large_image_location,$width,$height,$scale);
		} else {
			$scale = 1;
			$uploaded = $upload->resizeImage($large_image_location,$width,$height,$scale);
		}

		//Delete the thumbnail file so the user can create a new one
		/*if (file_exists($thumb_image_location)) {
			unlink($thumb_image_location);
		}*/
	}

	if (file_exists($large_image_location)) {
		$thumb_photo_exists = $upload_path . $large_image_name . $file_ext;
		$large_photo_exists = $upload_path . $large_image_name . $file_ext;
	}
開發者ID:nopticon,項目名稱:rockr,代碼行數:30,代碼來源:index.php


注:本文中的upload::resizeImage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。