Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jamiebicknell/Thumb
A simple, local image only, thumbnail generation script written in PHP
https://github.com/jamiebicknell/Thumb
gd php thumbnail thumbnails
Last synced: 10 days ago
JSON representation
A simple, local image only, thumbnail generation script written in PHP
- Host: GitHub
- URL: https://github.com/jamiebicknell/Thumb
- Owner: jamiebicknell
- License: mit
- Created: 2012-07-18T10:29:37.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2017-04-21T07:50:30.000Z (over 7 years ago)
- Last Synced: 2024-07-31T12:07:43.690Z (3 months ago)
- Topics: gd, php, thumbnail, thumbnails
- Language: PHP
- Homepage:
- Size: 32.2 KB
- Stars: 124
- Watchers: 14
- Forks: 60
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- favorite-link - 一个简单的本地图像,用 PHP 编写的缩略图生成脚本。
README
# Thumb
A simple, local image only, thumbnail generation script written in PHP with a file based cache and optional browser based cache.
## Example Usage
Firstly, make sure your cache directory is writable, then access the script like so:
```html
```## Query Parameters
Key
Example Value
Default
Description
src
./images/photo.jpg
Absolute path, relative path, or local URL to the source image. Remote URLs are not allowed
size
100, 100x200, 100x, x100, <500
100
Width and/or height must be between 8 and 1500
crop
0 - 1
1
0 = Displays the entire image within the canvas
1 = Crop the image so that the entire canvas is used
trim
0 - 1
0
0 = Displays white space for unused canvas
1 = Removes any white space
zoom
0 - 1
0
For when the size of the canvas is larger than the original image size
0 = Will not enlarge image
1 = Enlarges image beyond the original image size
align
c, t, r, b, l, tl, tr, br, bl
c
Alignment of image when cropped
sharpen
0 - 100
0
Percentage strength of the image sharpness, based on the percentage midpoint of 12 (strong) and 28 (weak)
gray
0 - 1
0
0 = Displays resized image as normal
1 = Converts image to grayscale
ignore
0 - 1
0
0 = Displays resized image as normal
1 = Displays original image file with the animation present
## Size Parameter
Value
Description
250
Creates a square image 250px in width and 250px in height
250x400
Creates an image 250px in width and 400px in height
250x
Creates an image with a width of 250px and the height will be automatically calculated to maintain the aspect ration of the original image
x250
Createse an image with a height of 250px and the width will be automatically calculated to maintain the aspect ration of the original image
<800
Creates an image where the width or height does not exceed 800px. For landscape images the width will be 800px and the height will be automatically calculated, and for portrait images the height will be 800px and the width will be automatically calculated.
## Automatic Orientation Correction
If you're dealing with images straight from a camera, some may contain [EXIF](http://en.wikipedia.org/wiki/Exchangeable_image_file_format) data which specifies the original orientation the image should be viewed at.
To enable this feature, change the constant `ADJUST_ORIENTATION` to `true`.
More information, and an in depth analysis of EXIF Orientation can be found [in this article](http://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/) written by @[daveperrett](http://www.twitter.com/daveperrett)
## License
Thumb.php is licensed under the [MIT license](http://opensource.org/licenses/MIT), see [LICENSE.md](https://github.com/jamiebicknell/Thumb/blob/master/LICENSE.md) for details.