Example #1
0
<?php

require_once '../classes/image.class.php';
$size = 600;
$image = new thumbnail($_GET['src']);
//$image->size_width($size);   //Фіксована ширина
//$image->size_height($size);  //Фіксована висота
$image->size_auto($size);
//Фіксована ширина або висота
//$image->size_crop($size);    //Одинакові ширина та висота
//$image->size_width_height($size,$size_h); //Довільна ширина та висота
$image->add_logo("watermark.png");
//Додати лого до картинки
$image->show();
Example #2
0
// check method
if ($mode == "w") {
    $thumb->size_width($size);
}
if ($mode == "h") {
    $thumb->size_height($size);
}
if ($mode == "a") {
    $thumb->size_auto($size);
}
// jpeg quality
$thumb->jpeg_quality($jpeg_quality);
// save cache
$thumb->save($cachepath);
// show file
$thumb->show();
// class thumbail
class thumbnail
{
    var $img;
    function thumbnail($imgfile)
    {
        //detect image format
        $this->img["format"] = ereg_replace(".*\\.(.*)\$", "\\1", $imgfile);
        $this->img["format"] = strtoupper($this->img["format"]);
        if (!eregi('cache/', $imgfile)) {
            if ($this->img["format"] == "JPG" || $this->img["format"] == "JPEG") {
                //JPEG
                $this->img["format"] = "JPEG";
                $this->img["src"] = ImageCreateFromJPEG($imgfile);
            } elseif ($this->img["format"] == "PNG") {