本文整理匯總了PHP中app\Image::uploadImage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Image::uploadImage方法的具體用法?PHP Image::uploadImage怎麽用?PHP Image::uploadImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Image
的用法示例。
在下文中一共展示了Image::uploadImage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ajaxImageUpload
public function ajaxImageUpload()
{
$user_id = Input::get('user_id');
$file = Input::file('display_image');
//get the image folder to store the image, in this case the specific restaurant folder.
$image_folder = '/assets/images/users/';
//upload the image and return the file path
$file_path = Image::uploadImage($file, $image_folder);
if ($file_path['status'] != 1) {
return Response::json(['success' => false, 'errors' => $file_path['errors']]);
}
$user = User::find($user_id);
$user->display_image = $file_path['data'];
$user->save();
User::updateUserSession();
return Response::json(['success' => true, 'message' => 'Profile Image Updated.', 'file' => $user->display_image]);
}