Code Monkey home page Code Monkey logo

timthumb's Introduction

TimThumb

TimThumb is a simple, flexible, PHP script that resizes images.

My intention is to have an updated repo which works with composer on all my known LAMP server configurations because the only timthumb repo on packagist is out of date (2.8.11) which doesn't works for me.

Installing with composer

To use this repo on you composer proyect, simply add an vcs repository pointing to this GitHub repo and require it on your composer.json file:

{
	"repositories": [
		{
			"type": "vcs",
			"url": "https://github.com/GabrielGil/TimThumb"
		}
	],
	"require": {
		"gabrielgil/timthumb": "2.*"
	}
}

A better way to use TimThumb

I think it's a good way of using timthumb, to store it on a non-public folder (Like the whole composer vendor folder) and then create your own resizer endpoint. If you use it with composer (as this repo is intended to), hide your vendor folder (Just an advice).

How you create your own app structure depends on you, or on your team. If your desired resize endpoint points to a specific file, you can use this code there.

	
/* Redefine your with own defaults here.
 * This are just examples, no one is required. */

// Set the time the cache is cleaned (Since the image generation) to one month (2592000/60/60/24=30)
define ('FILE_CACHE_MAX_FILE_AGE', 2592000);
// Use the default system cache dir so your project's folder stays clean.
define ('FILE_CACHE_DIRECTORY', sys_get_temp_dir());
// Quality set to 100%
define ('DEFAULT_Q', 100);

// Start timthumb.
timthumb::start();

After this is set up, you can use all the parameters shown in the official documentation.

Documentation

You can also check the original documentation at binarymoon.uk

timthumb's People

Contributors

gabrielgil avatar

Watchers

James Cloos avatar Mahamoud Mohamed avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.