simple-thumbnail/simple-thumbnail

This class is designed to be a simple and lightweight way to create thumbnails.

Installs: 55

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 1

Open Issues: 0

pkg:composer/simple-thumbnail/simple-thumbnail

dev-master 2013-12-28 07:06 UTC

This package is not auto-updated.

Last update: 2025-11-04 08:24:04 UTC


README

Simple and lightweight PHP Class to create thumbnails.

Getting Started

Import the class

include 'SimpleThumbnail.php';

Instance the class, configure size, load image source and set name of thumbnail

$simpleThumbnail = new SimpleThumbnail;
$simpleThumbnail->setWidth(250);
$simpleThumbnail->setHeight(250);
$simpleThumbnail->setQuality(100);
$simpleThumbnail->generate("image.png", "thumb.jpg");

Methods

There are some methods that you must use to generate your thumbnail:

  • setWidth(int $width)

Set width of thumbnail, parameter must be a integer value.

  • setHeight(int $height)

Set height of thumbnail, parameter must be a integer value.

  • setQuality(int $quality)

Set quality of thumbnail, parameter must be a integer value between 1 and 100..

  • generate(string $sourceImage, string $thumbnailTarget)

This method will load original image from a source path given as string on the first parameter and will generate a thumbnail with the size and quality given on settings methods.

The Thumbnail will be saved on the path passed as string on the second parameter.

About

Its just a class who load original image and generate a thumbnail with a size and quality given.

Why?

This class is designed to be a simple and lightweight way to create thumbnails.

The idea came from my need to generate thumbnails and many classes that I found on the internet had several features that are not necessary to generate a simple thumbnail.

Who?

Created by Guilherme Farias, a web developer from Brazil.

License?

SimpleThumbnail is released under the terms of the MIT license.