laravel-imageupload, 在函数中自动调整大小,使用 Laravel的构建来上传图像

分享于 

38分钟阅读

GitHub

  繁體 雙語
Upload image using Laravel's build in function and resize it using Imagine library automatically.
  • 源代码名称:laravel-imageupload
  • 源代码网址:http://www.github.com/matriphe/laravel-imageupload
  • laravel-imageupload源代码文档
  • laravel-imageupload源代码下载
  • Git URL:
    git://www.github.com/matriphe/laravel-imageupload.git
    Git Clone代码到本地:
    git clone http://www.github.com/matriphe/laravel-imageupload
    Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/matriphe/laravel-imageupload
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
    Laravel Imageupload

    Build StatusTotal DownloadLatest Stable Version

    通过在函数中使用 Laravel 轻松地上传图像并自动调整它的大小。

    版本兼容性

    Laravel Imageupload安装命令
    4.2.x4.x 插件( 已经过时)composer require"matriphe/imageupload:4.2.*"
    5.0.x/5.1.x/5.2.x/5.3.x/5.4.x5.x 插件( 稳定)composer require"matriphe/imageupload:5.*"
    5.0.x/5.1.x/5.2.x/5.3.x/5.4.x6.0composer require"matriphe/imageupload:6.0"
    5.2.x/5.3.x/5.4.x/5.5.x6.1.x ( 最新)composer require"matriphe/imageupload:6.1.*"

    旧版本的Laravel 版本如下。 现在这个软件包将使用语义版本( semver ) 从版本 6.0开始。

    安装

    打开 composer.json 并要求以下行。

    "matriphe/imageupload": "6.*"

    或者你可以直接从项目目录运行这里命令。

    composer require "matriphe/imageupload"

    Laravel,5.1,5.2,and和 5.4

    打开 config/app.php 并在 providers 部分添加这里行。

    MatripheImageuploadImageuploadServiceProvider::class,

    仍在 config/app.php 文件中,在 aliases 部分添加此行。

    'Imageupload'=>MatripheImageuploadImageuploadFacade::class,

    Laravel 5.5

    没有什么要做的。它使用了 Laravel 自动包发现功能。

    发布配置和迁移文件

    要控制配置,你必须发布配置文件。

    php artisan vendor:publish --provider="MatripheImageuploadImageuploadServiceProvider"

    运行这里命令后,将有 config/imageupload.php 配置文件 database/migrations/2017_07_24_024410_create_image_upload_table.php 迁移文件。

    配置

    请检查 config/imageupload.php 以获得更详细的信息。 你可以根据你的环境使用 .env 进行配置。

    如果你只想发布配置文件,请运行这里命令。

    php artisan vendor:publish --provider="MatripheImageuploadImageuploadServiceProvider" --tag=imageupload-config

    迁移

    默认情况下,迁移文件将创建 image_uploads 表。 检查文件并修改以满足你的需要。

    如果你只想发布迁移文件,请运行这里命令。

    php artisan vendor:publish --provider="MatripheImageuploadImageuploadServiceProvider --tag=imageupload-migrations"

    模型

    你可以创建模型来扩展构建中的模型,方法是扩展 MatripheImageuploadImageuploadModel 请检查这里文件并调整以适应你的需要。

    <?phpnamespaceApp;useMatripheImageuploadImageuploadModel;classImageextendsImageuploadModel{protected$table='images';}

    尝试上传一些内容 !

    发布配置文件后,你可以设置路由。查看和开始上传内容。

    上传的文件将保存在 public/uploads 目录中。 当然,你可以通过发布和修改配置文件来更改这个。

    确保存储上传文件的目录是可以写的,并且可以通过 public 访问。

    路由示例

    <?php// routes.phpRoute::any('matriphe/imageupload', function() {$data= [];if (Request::hasFile('file')) {$data['result'] =Imageupload::upload(Request::file('file')); }return view('form.blade.php')->with($data);});

    视图

    在视图目录中添加这里。

    <!DOCTYPE html>
    <html>
     <head>
     <title>Imageupload</title>
     </head>
     <body>
     <formaction="{{ URL::current() }}"method="post"enctype="multipart/form-data">
     <inputtype="hidden"name="_token"value="{{ Session::token() }}">
     <pre>{{ (!empty($result)? print_r($result, 1) : '') }}</pre>
     <div>
     <inputtype="file"name="file">
     </div>
     <div>
     <buttontype="submit">Upload!</button>
     </div>
     </form>
     </body>
    </html>

    用法

    只需使用 Imageupload::upload(Request::file('file')) 函数,它将负责裁剪和重命名。 当然,你可以通过传递参数来动态修改 Imageupload::upload($filesource, $newfilename, $path)

    函数的返回是 IlluminateSupportCollection的实例。 你可以使用 toArray() 或者 toJson() 方法轻松地转换为 array 或者 JSON。

    设置输出

    若要在飞行时更改输出,请在调用 upload($request) 之前使用方法 ouput($output)。 选项是 collectionjsondbarray ( 默认值)。 请参见配置文件以设置默认输出。

    db 选项将自动将输出保存到数据库并返回 MatripheImageuploadImageuploadModel 对象。

    示例

    if (Request::hasFile('file')) {$result=Imageupload::upload(Request::file('file'));}if (Request::hasFile('file')) {$result=Imageupload::output('json')->upload(Request::file('file'));}

    输出示例

    JSON
    { 
     "original_filename":"IMG_20170619_195131.jpg",
     "original_filepath":"/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131.jpg",
     "original_filedir":"uploads/images/IMG_20170619_195131.jpg",
     "original_extension":"jpg",
     "original_mime":"image/jpeg",
     "original_filesize":1379716,
     "original_width":2592,
     "original_height":4608,
     "exif":{ 
     "FileName":"phpPfn2JP",
     "FileDateTime":1500894790,
     "FileSize":1379716,
     "FileType":2,
     "MimeType":"image/jpeg",
     "SectionsFound":"ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS, INTEROP",
     "COMPUTED":{ 
     "html":"width="2592" height="4608"",
     "Height":4608,
     "Width":2592,
     "IsColor":1,
     "ByteOrderMotorola":1,
     "ApertureFNumber":"f/2.0",
     "Thumbnail.FileType":2,
     "Thumbnail.MimeType":"image/jpeg" },
     "Make":"Xiaomi",
     "Model":"Redmi Note3",
     "XResolution":"72/1",
     "YResolution":"72/1",
     "ResolutionUnit":2,
     "Software":"kenzo-user 6.0.1 MMB29M 7.6.7 release-keys",
     "DateTime":"2017:06:19 19:51:31",
     "YCbCrPositioning":1,
     "Exif_IFD_Pointer":234,
     "GPS_IFD_Pointer":718,
     "THUMBNAIL":{ 
     "Compression":6,
     "XResolution":"72/1",
     "YResolution":"72/1",
     "ResolutionUnit":2,
     "JPEGInterchangeFormat":898,
     "JPEGInterchangeFormatLength":15696 },
     "ExposureTime":"1/33",
     "FNumber":"200/100",
     "ExposureProgram":0,
     "ISOSpeedRatings":854,
     "ExifVersion":"0220",
     "DateTimeOriginal":"2017:06:19 19:51:31",
     "DateTimeDigitized":"2017:06:19 19:51:31",
     "ComponentsConfiguration":"u0001u0002u0003u0000",
     "ShutterSpeedValue":"5058/1000",
     "ApertureValue":"200/100",
     "BrightnessValue":"300/100",
     "MeteringMode":1,
     "Flash":16,
     "FocalLength":"357/100",
     "SubSecTime":"123298",
     "SubSecTimeOriginal":"123298",
     "SubSecTimeDigitized":"123298",
     "FlashPixVersion":"0100",
     "ColorSpace":1,
     "ExifImageWidth":2592,
     "ExifImageLength":4608,
     "InteroperabilityOffset":687,
     "SensingMethod":2,
     "SceneType":"u0001",
     "ExposureMode":0,
     "WhiteBalance":0,
     "FocalLengthIn35mmFilm":4,
     "SceneCaptureType":0,
     "GPSAltitudeRef":"200/100",
     "GPSTimeStamp":[ 
     "12/1",
     "51/1",
     "30/1" ],
     "GPSDateStamp":"2017:06:19",
     "InterOperabilityIndex":"R98",
     "InterOperabilityVersion":"0100" },
     "path":"/Volumes/data/Development/php/laravel/51/public/uploads/images",
     "dir":"uploads/images",
     "filename":"IMG_20170619_195131.jpg",
     "basename":"IMG_20170619_195131",
     "dimensions":{ 
     "square50":{ 
     "path":"/Volumes/data/Development/php/laravel/51/public/uploads/images",
     "dir":"uploads/images/IMG_20170619_195131_square50.jpg",
     "filename":"IMG_20170619_195131_square50.jpg",
     "filepath":"/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square50.jpg",
     "filedir":"uploads/images/IMG_20170619_195131_square50.jpg",
     "width":50,
     "height":50,
     "filesize":1379716,
     "is_squared":true },
     "square100":{ 
     "path":"/Volumes/data/Development/php/laravel/51/public/uploads/images",
     "dir":"uploads/images/IMG_20170619_195131_square100.jpg",
     "filename":"IMG_20170619_195131_square100.jpg",
     "filepath":"/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square100.jpg",
     "filedir":"uploads/images/IMG_20170619_195131_square100.jpg",
     "width":100,
     "height":100,
     "filesize":1379716,
     "is_squared":true },
     "square200":{ 
     "path":"/Volumes/data/Development/php/laravel/51/public/uploads/images",
     "dir":"uploads/images/IMG_20170619_195131_square200.jpg",
     "filename":"IMG_20170619_195131_square200.jpg",
     "filepath":"/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square200.jpg",
     "filedir":"uploads/images/IMG_20170619_195131_square200.jpg",
     "width":200,
     "height":200,
     "filesize":1379716,
     "is_squared":true },
     "square400":{ 
     "path":"/Volumes/data/Development/php/laravel/51/public/uploads/images",
     "dir":"uploads/images/IMG_20170619_195131_square400.jpg",
     "filename":"IMG_20170619_195131_square400.jpg",
     "filepath":"/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square400.jpg",
     "filedir":"uploads/images/IMG_20170619_195131_square400.jpg",
     "width":400,
     "height":400,
     "filesize":1379716,
     "is_squared":true },
     "size50":{ 
     "path":"/Volumes/data/Development/php/laravel/51/public/uploads/images",
     "dir":"uploads/images/IMG_20170619_195131_size50.jpg",
     "filename":"IMG_20170619_195131_size50.jpg",
     "filepath":"/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size50.jpg",
     "filedir":"uploads/images/IMG_20170619_195131_size50.jpg",
     "width":28,
     "height":50,
     "filesize":1379716,
     "is_squared":false },
     "size100":{ 
     "path":"/Volumes/data/Development/php/laravel/51/public/uploads/images",
     "dir":"uploads/images/IMG_20170619_195131_size100.jpg",
     "filename":"IMG_20170619_195131_size100.jpg",
     "filepath":"/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size100.jpg",
     "filedir":"uploads/images/IMG_20170619_195131_size100.jpg",
     "width":56,
     "height":100,
     "filesize":1379716,
     "is_squared":false },
     "size200":{ 
     "path":"/Volumes/data/Development/php/laravel/51/public/uploads/images",
     "dir":"uploads/images/IMG_20170619_195131_size200.jpg",
     "filename":"IMG_20170619_195131_size200.jpg",
     "filepath":"/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size200.jpg",
     "filedir":"uploads/images/IMG_20170619_195131_size200.jpg",
     "width":112,
     "height":200,
     "filesize":1379716,
     "is_squared":false },
     "size400":{ 
     "path":"/Volumes/data/Development/php/laravel/51/public/uploads/images",
     "dir":"uploads/images/IMG_20170619_195131_size400.jpg",
     "filename":"IMG_20170619_195131_size400.jpg",
     "filepath":"/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size400.jpg",
     "filedir":"uploads/images/IMG_20170619_195131_size400.jpg",
     "width":225,
     "height":400,
     "filesize":1379716,
     "is_squared":false }
     }
    }
    array
    
    Array
    
    
    (
    
    
     [original_filename] => IMG_20170619_195131.jpg
    
    
     [original_filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131.jpg
    
    
     [original_filedir] => uploads/images/IMG_20170619_195131.jpg
    
    
     [original_extension] => jpg
    
    
     [original_mime] => image/jpeg
    
    
     [original_filesize] => 1379716
    
    
     [original_width] => 2592
    
    
     [original_height] => 4608
    
    
     [exif] => Array
    
    
     (
    
    
     [FileName] => phpPfn2JP
    
    
     [FileDateTime] => 1500894790
    
    
     [FileSize] => 1379716
    
    
     [FileType] => 2
    
    
     [MimeType] => image/jpeg
    
    
     [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS, INTEROP
    
    
     [COMPUTED] => Array
    
    
     (
    
    
     [html] => width="2592" height="4608"
    
    
     [Height] => 4608
    
    
     [Width] => 2592
    
    
     [IsColor] => 1
    
    
     [ByteOrderMotorola] => 1
    
    
     [ApertureFNumber] => f/2.0
    
    
     [Thumbnail.FileType] => 2
    
    
     [Thumbnail.MimeType] => image/jpeg
    
    
     )
    
    
    
     [Make] => Xiaomi
    
    
     [Model] => Redmi Note3
    
    
     [XResolution] => 72/1
    
    
     [YResolution] => 72/1
    
    
     [ResolutionUnit] => 2
    
    
     [Software] => kenzo-user 6.0.1 MMB29M 7.6.7 release-keys
    
    
     [DateTime] => 2017:06:19 19:51:31
    
    
     [YCbCrPositioning] => 1
    
    
     [Exif_IFD_Pointer] => 234
    
    
     [GPS_IFD_Pointer] => 718
    
    
     [THUMBNAIL] => Array
    
    
     (
    
    
     [Compression] => 6
    
    
     [XResolution] => 72/1
    
    
     [YResolution] => 72/1
    
    
     [ResolutionUnit] => 2
    
    
     [JPEGInterchangeFormat] => 898
    
    
     [JPEGInterchangeFormatLength] => 15696
    
    
     )
    
    
    
     [ExposureTime] => 1/33
    
    
     [FNumber] => 200/100
    
    
     [ExposureProgram] => 0
    
    
     [ISOSpeedRatings] => 854
    
    
     [ExifVersion] => 0220
    
    
     [DateTimeOriginal] => 2017:06:19 19:51:31
    
    
     [DateTimeDigitized] => 2017:06:19 19:51:31
    
    
     [ComponentsConfiguration] => ���
    
    
     [ShutterSpeedValue] => 5058/1000
    
    
     [ApertureValue] => 200/100
    
    
     [BrightnessValue] => 300/100
    
    
     [MeteringMode] => 1
    
    
     [Flash] => 16
    
    
     [FocalLength] => 357/100
    
    
     [SubSecTime] => 123298
    
    
     [SubSecTimeOriginal] => 123298
    
    
     [SubSecTimeDigitized] => 123298
    
    
     [FlashPixVersion] => 0100
    
    
     [ColorSpace] => 1
    
    
     [ExifImageWidth] => 2592
    
    
     [ExifImageLength] => 4608
    
    
     [InteroperabilityOffset] => 687
    
    
     [SensingMethod] => 2
    
    
     [SceneType] => �
    
    
     [ExposureMode] => 0
    
    
     [WhiteBalance] => 0
    
    
     [FocalLengthIn35mmFilm] => 4
    
    
     [SceneCaptureType] => 0
    
    
     [GPSAltitudeRef] => 200/100
    
    
     [GPSTimeStamp] => Array
    
    
     (
    
    
     [0] => 12/1
    
    
     [1] => 51/1
    
    
     [2] => 30/1
    
    
     )
    
    
    
     [GPSDateStamp] => 2017:06:19
    
    
     [InterOperabilityIndex] => R98
    
    
     [InterOperabilityVersion] => 0100
    
    
     )
    
    
    
     [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images
    
    
     [dir] => uploads/images
    
    
     [filename] => IMG_20170619_195131.jpg
    
    
     [basename] => IMG_20170619_195131
    
    
     [dimensions] => Array
    
    
     (
    
    
     [square50] => Array
    
    
     (
    
    
     [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images
    
    
     [dir] => uploads/images/IMG_20170619_195131_square50.jpg
    
    
     [filename] => IMG_20170619_195131_square50.jpg
    
    
     [filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square50.jpg
    
    
     [filedir] => uploads/images/IMG_20170619_195131_square50.jpg
    
    
     [width] => 50
    
    
     [height] => 50
    
    
     [filesize] => 1379716
    
    
     [is_squared] => 1
    
    
     )
    
    
    
     [square100] => Array
    
    
     (
    
    
     [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images
    
    
     [dir] => uploads/images/IMG_20170619_195131_square100.jpg
    
    
     [filename] => IMG_20170619_195131_square100.jpg
    
    
     [filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square100.jpg
    
    
     [filedir] => uploads/images/IMG_20170619_195131_square100.jpg
    
    
     [width] => 100
    
    
     [height] => 100
    
    
     [filesize] => 1379716
    
    
     [is_squared] => 1
    
    
     )
    
    
    
     [square200] => Array
    
    
     (
    
    
     [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images
    
    
     [dir] => uploads/images/IMG_20170619_195131_square200.jpg
    
    
     [filename] => IMG_20170619_195131_square200.jpg
    
    
     [filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square200.jpg
    
    
     [filedir] => uploads/images/IMG_20170619_195131_square200.jpg
    
    
     [width] => 200
    
    
     [height] => 200
    
    
     [filesize] => 1379716
    
    
     [is_squared] => 1
    
    
     )
    
    
    
     [square400] => Array
    
    
     (
    
    
     [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images
    
    
     [dir] => uploads/images/IMG_20170619_195131_square400.jpg
    
    
     [filename] => IMG_20170619_195131_square400.jpg
    
    
     [filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square400.jpg
    
    
     [filedir] => uploads/images/IMG_20170619_195131_square400.jpg
    
    
     [width] => 400
    
    
     [height] => 400
    
    
     [filesize] => 1379716
    
    
     [is_squared] => 1
    
    
     )
    
    
    
     [size50] => Array
    
    
     (
    
    
     [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images
    
    
     [dir] => uploads/images/IMG_20170619_195131_size50.jpg
    
    
     [filename] => IMG_20170619_195131_size50.jpg
    
    
     [filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size50.jpg
    
    
     [filedir] => uploads/images/IMG_20170619_195131_size50.jpg
    
    
     [width] => 28
    
    
     [height] => 50
    
    
     [filesize] => 1379716
    
    
     [is_squared] => 
    
    
     )
    
    
    
     [size100] => Array
    
    
     (
    
    
     [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images
    
    
     [dir] => uploads/images/IMG_20170619_195131_size100.jpg
    
    
     [filename] => IMG_20170619_195131_size100.jpg
    
    
     [filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size100.jpg
    
    
     [filedir] => uploads/images/IMG_20170619_195131_size100.jpg
    
    
     [width] => 56
    
    
     [height] => 100
    
    
     [filesize] => 1379716
    
    
     [is_squared] => 
    
    
     )
    
    
    
     [size200] => Array
    
    
     (
    
    
     [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images
    
    
     [dir] => uploads/images/IMG_20170619_195131_size200.jpg
    
    
     [filename] => IMG_20170619_195131_size200.jpg
    
    
     [filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size200.jpg
    
    
     [filedir] => uploads/images/IMG_20170619_195131_size200.jpg
    
    
     [width] => 112
    
    
     [height] => 200
    
    
     [filesize] => 1379716
    
    
     [is_squared] => 
    
    
     )
    
    
    
     [size400] => Array
    
    
     (
    
    
     [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images
    
    
     [dir] => uploads/images/IMG_20170619_195131_size400.jpg
    
    
     [filename] => IMG_20170619_195131_size400.jpg
    
    
     [filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size400.jpg
    
    
     [filedir] => uploads/images/IMG_20170619_195131_size400.jpg
    
    
     [width] => 225
    
    
     [height] => 400
    
    
     [filesize] => 1379716
    
    
     [is_squared] => 
    
    
     )
    
    
    
     )
    
    
    
    )
    
    
    
    
    集合
    IlluminateSupportCollectionObject( [items:protected] =>Array ( [original_filename] =>IMG_20170619_195131.jpg [original_filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131.jpg [original_filedir] =>uploads/images/IMG_20170619_195131.jpg [original_extension] =>jpg [original_mime] =>image/jpeg [original_filesize] =>1379716 [original_width] =>2592 [original_height] =>4608 [exif] =>Array ( [FileName] =>phpGacSlt [FileDateTime] =>1500895792 [FileSize] =>1379716 [FileType] =>2 [MimeType] =>image/jpeg [SectionsFound] =>ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS, INTEROP [COMPUTED] =>Array ( [html] =>width="2592"height="4608" [Height] =>4608 [Width] =>2592 [IsColor] =>1 [ByteOrderMotorola] =>1 [ApertureFNumber] =>f/2.0 [Thumbnail.FileType] =>2 [Thumbnail.MimeType] =>image/jpeg ) [Make] =>Xiaomi [Model] =>RedmiNote3 [XResolution] =>72/1 [YResolution] =>72/1 [ResolutionUnit] =>2 [Software] =>kenzo-user6.0.1MMB29M7.6.7release-keys [DateTime] =>2017:06:1919:51:31 [YCbCrPositioning] =>1 [Exif_IFD_Pointer] =>234 [GPS_IFD_Pointer] =>718 [THUMBNAIL] =>Array ( [Compression] =>6 [XResolution] =>72/1 [YResolution] =>72/1 [ResolutionUnit] =>2 [JPEGInterchangeFormat] =>898 [JPEGInterchangeFormatLength] =>15696 ) [ExposureTime] =>1/33 [FNumber] =>200/100 [ExposureProgram] =>0 [ISOSpeedRatings] =>854 [ExifVersion] =>0220 [DateTimeOriginal] =>2017:06:1919:51:31 [DateTimeDigitized] =>2017:06:1919:51:31 [ComponentsConfiguration] => ��� [ShutterSpeedValue] =>5058/1000 [ApertureValue] =>200/100 [BrightnessValue] =>300/100 [MeteringMode] =>1 [Flash] =>16 [FocalLength] =>357/100 [SubSecTime] =>123298 [SubSecTimeOriginal] =>123298 [SubSecTimeDigitized] =>123298 [FlashPixVersion] =>0100 [ColorSpace] =>1 [ExifImageWidth] =>2592 [ExifImageLength] =>4608 [InteroperabilityOffset] =>687 [SensingMethod] =>2 [SceneType] => [ExposureMode] =>0 [WhiteBalance] =>0 [FocalLengthIn35mmFilm] =>4 [SceneCaptureType] =>0 [GPSAltitudeRef] =>200/100 [GPSTimeStamp] =>Array ( [0] =>12/1 [1] =>51/1 [2] =>30/1 ) [GPSDateStamp] =>2017:06:19 [InterOperabilityIndex] =>R98 [InterOperabilityVersion] =>0100 ) [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images [dir] =>uploads/images [filename] =>IMG_20170619_195131.jpg [basename] =>IMG_20170619_195131 [dimensions] =>Array ( [square50] =>Array ( [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images [dir] =>uploads/images/IMG_20170619_195131_square50.jpg [filename] =>IMG_20170619_195131_square50.jpg [filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square50.jpg [filedir] =>uploads/images/IMG_20170619_195131_square50.jpg [width] =>50 [height] =>50 [filesize] =>1379716 [is_squared] =>1 ) [square100] =>Array ( [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images [dir] =>uploads/images/IMG_20170619_195131_square100.jpg [filename] =>IMG_20170619_195131_square100.jpg [filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square100.jpg [filedir] =>uploads/images/IMG_20170619_195131_square100.jpg [width] =>100 [height] =>100 [filesize] =>1379716 [is_squared] =>1 ) [square200] =>Array ( [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images [dir] =>uploads/images/IMG_20170619_195131_square200.jpg [filename] =>IMG_20170619_195131_square200.jpg [filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square200.jpg [filedir] =>uploads/images/IMG_20170619_195131_square200.jpg [width] =>200 [height] =>200 [filesize] =>1379716 [is_squared] =>1 ) [square400] =>Array ( [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images [dir] =>uploads/images/IMG_20170619_195131_square400.jpg [filename] =>IMG_20170619_195131_square400.jpg [filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square400.jpg [filedir] =>uploads/images/IMG_20170619_195131_square400.jpg [width] =>400 [height] =>400 [filesize] =>1379716 [is_squared] =>1 ) [size50] =>Array ( [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images [dir] =>uploads/images/IMG_20170619_195131_size50.jpg [filename] =>IMG_20170619_195131_size50.jpg [filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size50.jpg [filedir] =>uploads/images/IMG_20170619_195131_size50.jpg [width] =>28 [height] =>50 [filesize] =>1379716 [is_squared] => ) [size100] =>Array ( [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images [dir] =>uploads/images/IMG_20170619_195131_size100.jpg [filename] =>IMG_20170619_195131_size100.jpg [filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size100.jpg [filedir] =>uploads/images/IMG_20170619_195131_size100.jpg [width] =>56 [height] =>100 [filesize] =>1379716 [is_squared] => ) [size200] =>Array ( [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images [dir] =>uploads/images/IMG_20170619_195131_size200.jpg [filename] =>IMG_20170619_195131_size200.jpg [filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size200.jpg [filedir] =>uploads/images/IMG_20170619_195131_size200.jpg [width] =>112 [height] =>200 [filesize] =>1379716 [is_squared] => ) [size400] =>Array ( [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images [dir] =>uploads/images/IMG_20170619_195131_size400.jpg [filename] =>IMG_20170619_195131_size400.jpg [filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size400.jpg [filedir] =>uploads/images/IMG_20170619_195131_size400.jpg [width] =>225 [height] =>400 [filesize] =>1379716 [is_squared] => ) ) ))
    ImageuploadModel
    MatripheImageuploadImageuploadModelObject( [thumbnailKeys:protected] =>Array ( [0] =>path [1] =>dir [2] =>filename [3] =>filepath [4] =>filedir [5] =>width [6] =>height [7] =>filesize ) [fillable:protected] =>Array ( [0] =>original_filename [1] =>original_filepath [2] =>original_filedir [3] =>original_extension [4] =>original_mime [5] =>original_filesize [6] =>original_width [7] =>original_height [8] =>path [9] =>dir [10] =>filename [11] =>basename [12] =>exif ) [connection:protected] => [table:protected] =>image_uploads [primaryKey:protected] =>id [perPage:protected] =>15 [incrementing] =>1 [timestamps] =>1 [attributes:protected] =>Array ( [original_filename] =>IMG_20170619_195131.jpg [original_filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131.jpg [original_filedir] =>uploads/images/IMG_20170619_195131.jpg [original_extension] =>jpg [original_mime] =>image/jpeg [original_filesize] =>1379716 [original_width] =>2592 [original_height] =>4608 [exif] => {"FileName":"php19qj3X","FileDateTime":1500906046,"FileSize":1379716,"FileType":2,"MimeType":"image/jpeg","SectionsFound":"ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS, INTEROP","COMPUTED":{"html":"width="2592" height="4608"","Height":4608,"Width":2592,"IsColor":1,"ByteOrderMotorola":1,"ApertureFNumber":"f/2.0","Thumbnail.FileType":2,"Thumbnail.MimeType":"image/jpeg"},"Make":"Xiaomi","Model":"Redmi Note3","XResolution":"72/1","YResolution":"72/1","ResolutionUnit":2,"Software":"kenzo-user 6.0.1 MMB29M 7.6.7 release-keys","DateTime":"2017:06:19 19:51:31","YCbCrPositioning":1,"Exif_IFD_Pointer":234,"GPS_IFD_Pointer":718,"THUMBNAIL":{"Compression":6,"XResolution":"72/1","YResolution":"72/1","ResolutionUnit":2,"JPEGInterchangeFormat":898,"JPEGInterchangeFormatLength":15696},"ExposureTime":"1/33","FNumber":"200/100","ExposureProgram":0,"ISOSpeedRatings":854,"ExifVersion":"0220","DateTimeOriginal":"2017:06:19 19:51:31","DateTimeDigitized":"2017:06:19 19:51:31","ComponentsConfiguration":"u0001u0002u0003u0000","ShutterSpeedValue":"5058/1000","ApertureValue":"200/100","BrightnessValue":"300/100","MeteringMode":1,"Flash":16,"FocalLength":"357/100","SubSecTime":"123298","SubSecTimeOriginal":"123298","SubSecTimeDigitized":"123298","FlashPixVersion":"0100","ColorSpace":1,"ExifImageWidth":2592,"ExifImageLength":4608,"InteroperabilityOffset":687,"SensingMethod":2,"SceneType":"u0001","ExposureMode":0,"WhiteBalance":0,"FocalLengthIn35mmFilm":4,"SceneCaptureType":0,"GPSAltitudeRef":"200/100","GPSTimeStamp":["12/1","51/1","30/1"],"GPSDateStamp":"2017:06:19","InterOperabilityIndex":"R98","InterOperabilityVersion":"0100"} [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images [dir] =>uploads/images [filename] =>IMG_20170619_195131.jpg [basename] =>IMG_20170619_195131 [updated_at] =>2017-07-2421:20:53 [created_at] =>2017-07-2421:20:53 [id] =>1 ) [original:protected] =>Array ( [original_filename] =>IMG_20170619_195131.jpg [original_filepath] =>/Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131.jpg [original_filedir] =>uploads/images/IMG_20170619_195131.jpg [original_extension] =>jpg [original_mime] =>image/jpeg [original_filesize] =>1379716 [original_width] =>2592 [original_height] =>4608 [exif] => {"FileName":"php19qj3X","FileDateTime":1500906046,"FileSize":1379716,"FileType":2,"MimeType":"image/jpeg","SectionsFound":"ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS, INTEROP","COMPUTED":{"html":"width="2592" height="4608"","Height":4608,"Width":2592,"IsColor":1,"ByteOrderMotorola":1,"ApertureFNumber":"f/2.0","Thumbnail.FileType":2,"Thumbnail.MimeType":"image/jpeg"},"Make":"Xiaomi","Model":"Redmi Note3","XResolution":"72/1","YResolution":"72/1","ResolutionUnit":2,"Software":"kenzo-user 6.0.1 MMB29M 7.6.7 release-keys","DateTime":"2017:06:19 19:51:31","YCbCrPositioning":1,"Exif_IFD_Pointer":234,"GPS_IFD_Pointer":718,"THUMBNAIL":{"Compression":6,"XResolution":"72/1","YResolution":"72/1","ResolutionUnit":2,"JPEGInterchangeFormat":898,"JPEGInterchangeFormatLength":15696},"ExposureTime":"1/33","FNumber":"200/100","ExposureProgram":0,"ISOSpeedRatings":854,"ExifVersion":"0220","DateTimeOriginal":"2017:06:19 19:51:31","DateTimeDigitized":"2017:06:19 19:51:31","ComponentsConfiguration":"u0001u0002u0003u0000","ShutterSpeedValue":"5058/1000","ApertureValue":"200/100","BrightnessValue":"300/100","MeteringMode":1,"Flash":16,"FocalLength":"357/100","SubSecTime":"123298","SubSecTimeOriginal":"123298","SubSecTimeDigitized":"123298","FlashPixVersion":"0100","ColorSpace":1,"ExifImageWidth":2592,"ExifImageLength":4608,"InteroperabilityOffset":687,"SensingMethod":2,"SceneType":"u0001","ExposureMode":0,"WhiteBalance":0,"FocalLengthIn35mmFilm":4,"SceneCaptureType":0,"GPSAltitudeRef":"200/100","GPSTimeStamp":["12/1","51/1","30/1"],"GPSDateStamp":"2017:06:19","InterOperabilityIndex":"R98","InterOperabilityVersion":"0100"} [path] =>/Volumes/data/Development/php/laravel/51/public/uploads/images [dir] =>uploads/images [filename] =>IMG_20170619_195131.jpg [basename] =>IMG_20170619_195131 [updated_at] =>2017-07-2421:20:53 [created_at] =>2017-07-2421:20:53 [id] =>1 ) [relations:protected] =>Array ( ) [hidden:protected] =>Array ( ) [visible:protected] =>Array ( ) [appends:protected] =>Array ( ) [guarded:protected] =>Array ( [0] =>* ) [dates:protected] =>Array ( ) [dateFormat:protected] => [casts:protected] =>Array ( ) [touches:protected] =>Array ( ) [observables:protected] =>Array ( ) [with:protected] =>Array ( ) [morphClass:protected] => [exists] =>1 [wasRecentlyCreated] =>1)

    变更日志

    版本 6.1

    • 支持输出类型 jsonarraycollectiondb
    • 使用 output() 方法添加对更改输出类型的支持
    • 删除对 Laravel 5.0和 5.1的支持

    版本 6.0

    版本 5.x-和 4.2.x

    下一个特性

    • 利用 Laravel的文件系统 存储上传文件。
    • 添加流明支持

    许可证

    MIT许可证( MIT ) 有关详细信息,请参阅许可证文件


    图像  AUTO  构建  FUNC  函数  Laravel  
    相关文章