PHP Classes

Imagens GD: Resize and add watermarks to images

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 216 This week: 1All time: 8,300 This week: 560Up
Version License PHP version Categories
class_imagens 1.0.1GNU General Publi...5.6PHP 5, Graphics
Description 

Author

This class can resize and add watermarks to images.

It can take the path of a given image file and creates a thumbnail image of a given size and store it in a given directory.

The class can also apply a given watermark and apply it to the resulting thumbnail at a given position.

Picture of Rael Antônio Carneiro Vaz
Name: Rael Antônio Carneiro ... <contact>
Classes: 1 package by
Country: Brazil Brazil
Age: ???
All time rank: 4091333 in Brazil Brazil
Week rank: 416 Up36 in Brazil Brazil Up

Example

<?php
require ("class.imagens.php");

$thumb = new imagens;
$thumb->img_w = 80; // pixels
$thumb->img_h = 80; // pixels
$thumb->img_arquivo = 'real-path-to-file.jpg';
$thumb->img_pos_x = "center";
$thumb->img_pos_y = "center";

$thumb->salvar = true;
$thumb->salvar_diretorio = 'cache/';
$thumb->salvar_nome = $thumb->img_arquivo;

$url_file_ext = explode('.', $thumb->img_arquivo);
$url_file_ext = end($url_file_ext);
$url_file_ext = strtolower($url_file_ext);

switch (
$url_file_ext) {
 case
'gif':
 
header('Content-type: image/gif');
 break;
 case
'png':
 
header('Content-type: image/png');
 break;
 default:
 
header('Content-type: image/jpeg');
 break;
 }
 
$expires = 60*60*24*365;//(1 dia)
 
header("Pragma: public");
 
header("Cache-Control: maxage=".$expires);
 
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
 echo
$thumb->gerar();
}
unset(
$thumb);
?>


  Files folder image Files  
File Role Description
Plain text file class.imagens.php Class Image GD
Accessible without login Plain text file Example.php Example example documentation

 Version Control Unique User Downloads Download Rankings  
 0%
Total:216
This week:1
All time:8,300
This week:560Up
User Comments (1)