定制 hesham14yahia/image-full-control 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

hesham14yahia/image-full-control

Composer 安装命令:

composer require hesham14yahia/image-full-control

包简介

Laravel package gives you full control of uploading, managing and manipulating app images.

README 文档

README

Laravel package gives you full control of uploading, managing and manipulating app images.

Requirements

  • PHP >=5.4
  • Fileinfo Extension

Supported Image Libraries

  • GD Library (>=2.0)
  • Imagick PHP extension (>=6.5.7)
  • Intervention Image

Create files and folders

In laravel public folder create uploads folder and then create a folder for whatever type of image you will upload, let's named for example users, and add to it .gitignore file with

*
!.gitignore

to prevent images to upload to git.

Install Package

composer require hesham14yahia/image-full-control

How to use it "uploading"

Just add

use Hesham14Yahia\ImageFullControl\ImageFullControl;

in your controller, then call static method uploadImage()

ImageFullControl::uploadImage($image, $folder_name)

just only two required parameters, first one the submitted image from the form, and the second one is the folder name, if you used in your method Independy Injection "Request" with the input file name "image" and folder name "users", it will be like that.

ImageFullControl::uploadImage($request->image, "users");

the method returns the uploaded image name.

More options "managing"

You can update image field with it, by adding the third parameter, which is an old image name, if we stick with the user example, and you created an instance of the user model, it will be like that.

ImageFullControl::uploadImage($request->image, "users", $user->image);

the method returns the new uploaded image name and deletes the old one, if you don't want to delete the old image, just don't pass it.

You can also "manipulating"

Determine image width or height or even quality, all this is optional, but they have an order you should stick with it, so if you will use all, it will be like that.

ImageFullControl::uploadImage($request->image, "users", $user->image, 50, 100, 75);

it will make the image with width 50px and height 100px and quality 75%, if you want to use only quality for example, it will be like that.

ImageFullControl::uploadImage($request->image, "users", $user->image, null, null, 11);

Note: default quilty is 100%.

Image Full Path

To make handling images easier, start from version 1.3.0 we add method returns image full path accepts folder name and image name, it will be like that.

ImageFullControl::imageFullPath("users", $image_name);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固