mmanos/laravel-image 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mmanos/laravel-image

Composer 安装命令:

composer require mmanos/laravel-image

包简介

An image management package for Laravel 4.

README 文档

README

This package provides the ability to conveniently work with uploaded images. It includes an images table and model, and has the ability to provide multiple versions of the same image with different dimensions, generated on demand.

Dependencies

This package relies on the laravel-storage to manage the image files, which supports writing to the local filesystem or the Amazon S3 service.

Installation Via Composer

Add this to you composer.json file, in the require object:

"mmanos/laravel-image": "dev-master"

After that, run composer install to install the package.

Add the service provider to app/config/app.php, within the providers array.

'providers' => array(
	// ...
	'Mmanos\Image\ImageServiceProvider',
)

Add a class alias to app/config/app.php, within the aliases array.

'aliases' => array(
	// ...
	'Image' => 'Mmanos\Image\Image',
)

Configuration

Publish the default config file to your application so you can make modifications.

$ php artisan config:publish mmanos/laravel-image

Publish and run the database migrations for this package.

$ php artisan migrate:publish mmanos/laravel-image
$ php artisan migrate

Note: Don't forget to create the writable directory used by the Storage package, if using the local filesystem driver.

Usage

Creating Images

Create an image from image data:

$image = Image::put($contents);

Create an image from an uploaded image file:

$image = Image::upload($_FILES['image']);

Create an image from a file on the filesystem:

$image = Image::copy($path);

Create an image from a URL to an image:

$image = Image::copyUrl($url);

Using Images

Get URL to the original image:

$url = $image->url();

Get URL to image constrained to 128px (best fit, maintaining aspect ratio):

$url = $image->url('128');

Get URL to image constrained to 128px in height (maintaining aspect ratio):

$url = $image->url('128h');

Get URL to image constrained to 128px in width (maintaining aspect ratio):

$url = $image->url('128w');

Get URL to image cropped to a 128px square:

$url = $image->url('128s');

Note: You may pass any arbitrary integer value for the image dimension.

统计信息

  • 总下载量: 72
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-09-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固