All Projects → onanying → image-php

onanying / image-php

Licence: other
很多PHP框架竟然没有图片设定宽高居中剪裁的功能,比如CodeIgniter,所以我自己封装了一个图片处理类:可设定宽高居中剪裁、设定宽高等比缩放、创建缩略图

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to image-php

node-imaginary
Minimalist node.js command-line & programmatic API client for imaginary
Stars: ✭ 94 (+452.94%)
Mutual labels:  resize, crop
Nova Advanced Image Field
🌄📐 A Laravel Nova advanced image field with cropping and resizing using Cropper.js and Intervention Image
Stars: ✭ 67 (+294.12%)
Mutual labels:  resize, crop
Imaging
Imaging is a simple image processing package for Go
Stars: ✭ 4,023 (+23564.71%)
Mutual labels:  resize, crop
downscale
Better image downscale with canvas.
Stars: ✭ 80 (+370.59%)
Mutual labels:  resize, crop
Cdn
Content Delivery Network on the top of MongoDb GridFs with on-the-fly image crop/resize
Stars: ✭ 117 (+588.24%)
Mutual labels:  resize, crop
Sharp
High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
Stars: ✭ 21,131 (+124200%)
Mutual labels:  resize, crop
Php Image Resize
PHP library to resize, scale and crop images. Cloud solution available at:
Stars: ✭ 955 (+5517.65%)
Mutual labels:  resize, crop
Docker Nginx Image Proxy
on the fly image cropping with gravity, resize and compression microservice
Stars: ✭ 79 (+364.71%)
Mutual labels:  resize, crop
Bimg
Go package for fast high-level image processing powered by libvips C library
Stars: ✭ 1,394 (+8100%)
Mutual labels:  resize, crop
Lipo
👄 Free image manipulation API service built on top of Sharp (an alternative to Jimp, Graphics Magic, Image Magick, and PhantomJS)
Stars: ✭ 101 (+494.12%)
Mutual labels:  resize, crop
Gimage
A PHP library for easy image handling. 🖼
Stars: ✭ 148 (+770.59%)
Mutual labels:  resize, crop
Mergi
go library for image programming (merge, crop, resize, watermark, animate, ease, transit)
Stars: ✭ 127 (+647.06%)
Mutual labels:  resize, crop
pdf-thumbnail
npm package to create the preview of a pdf file
Stars: ✭ 23 (+35.29%)
Mutual labels:  resize, crop
jimp-compact
✏️ Lightweight version of Jimp -- An image processing library written entirely in JavaScript for Node.js
Stars: ✭ 55 (+223.53%)
Mutual labels:  resize
mpv-scripts
dynamic-crop.lua script for mpv player/lib.
Stars: ✭ 43 (+152.94%)
Mutual labels:  crop
pixl
🚀 Lightweight image processing library in C++11
Stars: ✭ 31 (+82.35%)
Mutual labels:  resize
anim-event
Event Manager for Animation
Stars: ✭ 25 (+47.06%)
Mutual labels:  resize
OTResizableView
OTResizableView is a UIView library that can be resized with fingers.
Stars: ✭ 47 (+176.47%)
Mutual labels:  resize
vue-responsive-text
↔ Vue component that scales its child node in relation to its parent node's width
Stars: ✭ 23 (+35.29%)
Mutual labels:  resize
vesdk-android-demo
VideoEditor SDK: A fully customizable video editor for your app.
Stars: ✭ 90 (+429.41%)
Mutual labels:  crop

Image.php

很多PHP框架竟然没有图片设定宽高居中剪裁的功能,比如CI,所以我自己封装了一个图片处理类:可设定宽高居中剪裁、设定宽高等比缩放、创建缩略图

提供了以下功能

1. 居中剪裁 (设定宽高)
2. 等比缩放 (设定宽高, 源图小于宽高的不做缩放)
3. 创建缩略图
4. 如果操作网络图片, 会在根目录生成"tmp.jpg" (用于测试)

生成用户头像 (Sample 1)

$img = new Image();

$config['source_image'] = '/www/img/4533070d32960cd35e726ddb715a1eac.jpg';
$config['width'] = 200;
$config['height'] = 200;
$img->initialize($config);
$img->crop();  // 剪裁

创建缩略图 (Sample 2)

$img = new Image();

$config['source_image'] = '/www/img/4533070d32960cd35e726ddb715a1eac.jpg';
$config['width'] = 200;
$config['height'] = 200;
$config['create_thumb'] = true;
$img->initialize($config);
$img->crop();  // 剪裁

等比压缩图片并创建缩略图 (Sample 3)

$img = new Image();

$config['source_image'] = '/www/img/4533070d32960cd35e726ddb715a1eac.jpg';
$config['width'] = 1280;
$config['height'] = 720;
$img->initialize($config);
$img->resize();  // 缩放

$config = array(); // 清空之前的配置

$config['source_image'] = '/www/img/4533070d32960cd35e726ddb715a1eac.jpg';
$config['width'] = 600;
$config['height'] = 450;
$config['create_thumb'] = true;
$config['thumb_marker'] = '_small';  // 默认为'_thumb'
$img->initialize($config);
$img->crop();  // 剪裁
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].