当前位置: 首页>>代码示例>>PHP>>正文


PHP UnsharpMask函数代码示例

本文整理汇总了PHP中UnsharpMask函数的典型用法代码示例。如果您正苦于以下问题:PHP UnsharpMask函数的具体用法?PHP UnsharpMask怎么用?PHP UnsharpMask使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了UnsharpMask函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: write


//.........这里部分代码省略.........
             $this->_DST['width'] = round($this->shortside / ($this->_SRC['height'] / $this->_SRC['width']));
         }
     } else {
         // default dimensions
         $this->width = 100;
         $this->_DST['width'] = $this->width;
         $this->_DST['height'] = round($this->width / ($this->_SRC['width'] / $this->_SRC['height']));
     }
     // Wenn das Ursprungsbild kleiner als das Ziel-Bild ist, soll nicht hochskaliert werden
     if ($this->extrapolate === false && $this->_DST['height'] > $this->_SRC['height'] && $this->_DST['width'] > $this->_SRC['width']) {
         $this->_DST['width'] = $this->_SRC['width'];
         $this->_DST['height'] = $this->_SRC['height'];
     }
     $this->_DST['type'] = $this->_SRC['type'];
     $this->_DST['file'] = $outfile;
     // SRC einlesen
     if ($this->_SRC['type'] == 1) {
         $this->_SRC['image'] = imagecreatefromgif($this->_SRC['file']);
     } elseif ($this->_SRC['type'] == 2) {
         $this->_SRC['image'] = imagecreatefromjpeg($this->_SRC['file']);
     } elseif ($this->_SRC['type'] == 3) {
         $this->_SRC['image'] = imagecreatefrompng($this->_SRC['file']);
     }
     // Soll beschnitten werden?
     $off_w = 0;
     $off_h = 0;
     if ($this->crop != false) {
         if ($this->_SRC['height'] < $this->_SRC['width']) {
             $ratio = (double) ($this->_SRC['height'] / $this->_DST['height']);
             $cpyWidth = round($this->_DST['width'] * $ratio);
             if ($cpyWidth > $this->_SRC['width']) {
                 $ratio = (double) ($this->_SRC['width'] / $this->_DST['width']);
                 $cpyWidth = $this->_SRC['width'];
                 $cpyHeight = round($this->_DST['height'] * $ratio);
                 $off_w = 0;
                 $off_h = round(($this->_SRC['height'] - $cpyHeight) / 2);
                 $this->_SRC['height'] = $cpyHeight;
             } else {
                 $cpyHeight = $this->_SRC['height'];
                 $off_w = round(($this->_SRC['width'] - $cpyWidth) / 2);
                 $off_h = 0;
                 $this->_SRC['width'] = $cpyWidth;
             }
         } else {
             $ratio = (double) ($this->_SRC['width'] / $this->_DST['width']);
             $cpyHeight = round($this->_DST['height'] * $ratio);
             if ($cpyHeight > $this->_SRC['height']) {
                 $ratio = (double) ($this->_SRC['height'] / $this->_DST['height']);
                 $cpyHeight = $this->_SRC['height'];
                 $cpyWidth = round($this->_DST['width'] * $ratio);
                 $off_w = round(($this->_SRC['width'] - $cpyWidth) / 2);
                 $off_h = 0;
                 $this->_SRC['width'] = $cpyWidth;
             } else {
                 $cpyWidth = $this->_SRC['width'];
                 $off_w = 0;
                 $off_h = round(($this->_SRC['height'] - $cpyHeight) / 2);
                 $this->_SRC['height'] = $cpyHeight;
             }
         }
     }
     // DST erstellen
     $this->_DST['image'] = imagecreatetruecolor($this->_DST['width'], $this->_DST['height']);
     imagecopyresampled($this->_DST['image'], $this->_SRC['image'], 0, 0, $off_w, $off_h, $this->_DST['width'], $this->_DST['height'], $this->_SRC['width'], $this->_SRC['height']);
     if ($this->sharpen === true) {
         $this->_DST['image'] = UnsharpMask($this->_DST['image'], 80, 0.5, 3);
     }
     // finally: the real dimensions
     $this->height = $this->_DST['height'];
     $this->width = $this->_DST['width'];
     // Soll eine Lupe eingefügt werden?
     if ($this->hint === true) {
         //Soll der weiße Balken wirklich hinzugefügt werden?
         if ($this->addgreytohint === true) {
             $trans = imagecolorallocatealpha($this->_DST['image'], 255, 255, 255, 25);
             imagefilledrectangle($this->_DST['image'], 0, $this->_DST['height'] - 9, $this->_DST['width'], $this->_DST['height'], $trans);
         }
         $magnifier = imagecreatefromstring(gzuncompress(base64_decode("eJzrDPBz5+WS4mJgYOD19HAJAtLcIMzBBiRXrilXA1IsxU6eIRxAUMOR0gHkcxZ4RBYD1QiBMOOlu3V/gIISJa4RJc5FqYklmfl5CiGZuakMBoZ6hkZ6RgYGJs77ex2BalRBaoLz00rKE4tSGXwTk4vyc1NTMhMV3DKLUsvzi7KLFXwjFEAa2svWnGdgYPTydHEMqZhTOsE++1CAyNHzm2NZjgau+dAmXlAwoatQmOld3t/NPxlLMvY7sovPzXHf7re05BPzjpQTMkZTPjm1HlHkv6clYWK43Zt16rcDjdZ/3j2cd7qD4/HHH3GaprFrw0QZDHicORXl2JsPsveVTDz//L3N+WpxJ5Hff+10Tjdd2/Vi17vea79Om5w9zzyne9GLnWGrN8atby/ayXPOsu2w4quvVtxNCVVz5nAf3nDpZckBCedpqSc28WTOWnT7rZNXZSlPvFybie9EFc6y3bIMCn3JAoJ+kyyfn9qWq+LZ9Las26Jv482cDRE6Ci0B6gVbo2oj9KabzD8vyMK4ZMqMs2kSvW4chz88SXNzmeGjtj1QZK9M3HHL8L7HITX3t19//VVY8CYDg9Kvy2vDXu+6mGGxNOiltMPsjn/t9eJr0ja/FOdi5TyQ9Lz3fOqstOr99/dnro2vZ1jy76D/vYivPsBoYPB09XNZ55TQBAAJjs5s</body>")));
         imagealphablending($this->_DST['image'], true);
         imagecopy($this->_DST['image'], $magnifier, $this->_DST['width'] - 15, $this->_DST['height'] - 14, 0, 0, 11, 11);
         imagedestroy($magnifier);
     }
     if ($verbose) {
         echo "... saving image ...";
     }
     if ($this->_DST['type'] == 1) {
         imagetruecolortopalette($this->_DST['image'], false, 256);
         imagegif($this->_DST['image'], $this->_DST['file']);
     } elseif ($this->_DST['type'] == 2) {
         imagejpeg($this->_DST['image'], $this->_DST['file'], $this->quality);
     } elseif ($this->_DST['type'] == 3) {
         imagepng($this->_DST['image'], $this->_DST['file']);
     }
     if ($verbose) {
         echo "... image successfully saved ...";
     }
     imagedestroy($this->_DST['image']);
     imagedestroy($this->_SRC['image']);
     return true;
 }
开发者ID:bgarrels,项目名称:textpattern,代码行数:101,代码来源:class.thumb.php

示例2: resize

 /**
  * Resize
  *
  * @param integer $width  Width
  * @param integer $height Height
  *
  * @return boolean
  */
 public function resize($width, $height)
 {
     $result = false;
     if ($this->image) {
         $newImage = imagecreatetruecolor($width, $height);
         $transparentIndex = imagecolortransparent($this->image);
         if ($transparentIndex >= 0) {
             imagepalettecopy($this->image, $newImage);
             imagefill($newImage, 0, 0, $transparentIndex);
             imagecolortransparent($newImage, $transparentIndex);
             imagetruecolortopalette($newImage, true, 256);
         } else {
             imagealphablending($newImage, false);
             imagesavealpha($newImage, true);
             $transparent = imagecolorallocatealpha($newImage, 255, 255, 255, 127);
             imagefilledrectangle($newImage, 0, 0, $width, $height, $transparent);
         }
         $result = imagecopyresampled($newImage, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height);
         if ($result) {
             imagedestroy($this->image);
             $this->image = $newImage;
             $this->width = $width;
             $this->height = $height;
             if (\XLite::getInstance()->getOptions(array('images', 'unsharp_mask_filter_on_resize'))) {
                 include_once LC_DIR_LIB . 'phpunsharpmask.php';
                 $unsharpImage = UnsharpMask($this->image);
                 if ($unsharpImage) {
                     $this->image = $unsharpImage;
                 }
             }
         }
     }
     return $result;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:42,代码来源:GD.php

示例3: thumbnail


//.........这里部分代码省略.........
                        $src_x = round(($size[0] - $src_w) / 2);
                    }
                    break;
                default:
                    if ($size[1] / $size[0] >= $ratio) {
                        $src_h = round($src_w * $ratio);
                    } else {
                        $src_w = round($size[1] / $ratio);
                    }
                    break;
            }
        }
        $dst = imagecreatetruecolor($dst_w, $dst_h);
        if ($size[2] == 3) {
            imagealphablending($dst, false);
            imagesavealpha($dst, true);
        } else {
            if ($size[2] == 1) {
                $palletsize = imagecolorstotal($src);
                if ($src_transparency >= 0 && $src_transparency < $palletsize) {
                    $transparent_color = imagecolorsforindex($src, $src_transparency);
                    $current_transparent = imagecolorallocate($dst, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']);
                    imagefill($dst, 0, 0, $current_transparent);
                    imagecolortransparent($dst, $current_transparent);
                }
            }
        }
    } else {
        $dst = imagecreatetruecolor($dst_w, $dst_h);
        $bgcolor = imagecolorallocate($dst, 255, 255, 255);
        // 배경색
        if ($src_w < $dst_w) {
            if ($src_h >= $dst_h) {
                $dst_x = round(($dst_w - $src_w) / 2);
                $src_h = $dst_h;
            } else {
                $dst_x = round(($dst_w - $src_w) / 2);
                $dst_y = round(($dst_h - $src_h) / 2);
                $dst_w = $src_w;
                $dst_h = $src_h;
            }
        } else {
            if ($src_h < $dst_h) {
                $dst_y = round(($dst_h - $src_h) / 2);
                $dst_h = $src_h;
                $src_w = $dst_w;
            }
        }
        if ($size[2] == 3) {
            $bgcolor = imagecolorallocatealpha($dst, 0, 0, 0, 127);
            imagefill($dst, 0, 0, $bgcolor);
            imagealphablending($dst, false);
            imagesavealpha($dst, true);
        } else {
            if ($size[2] == 1) {
                $palletsize = imagecolorstotal($src);
                if ($src_transparency >= 0 && $src_transparency < $palletsize) {
                    $transparent_color = imagecolorsforindex($src, $src_transparency);
                    $current_transparent = imagecolorallocate($dst, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']);
                    imagefill($dst, 0, 0, $current_transparent);
                    imagecolortransparent($dst, $current_transparent);
                } else {
                    imagefill($dst, 0, 0, $bgcolor);
                }
            } else {
                imagefill($dst, 0, 0, $bgcolor);
            }
        }
    }
    imagecopyresampled($dst, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
    // sharpen 적용
    if ($is_sharpen && $is_large) {
        $val = explode('/', $um_value);
        UnsharpMask($dst, $val[0], $val[1], $val[2]);
    }
    if ($size[2] == 1) {
        imagegif($dst, $thumb_file);
    } else {
        if ($size[2] == 3) {
            if (!defined('G5_THUMB_PNG_COMPRESS')) {
                $png_compress = 5;
            } else {
                $png_compress = G5_THUMB_PNG_COMPRESS;
            }
            imagepng($dst, $thumb_file, $png_compress);
        } else {
            if (!defined('G5_THUMB_JPG_QUALITY')) {
                $jpg_quality = 90;
            } else {
                $jpg_quality = G5_THUMB_JPG_QUALITY;
            }
            imagejpeg($dst, $thumb_file, $jpg_quality);
        }
    }
    chmod($thumb_file, G5_FILE_PERMISSION);
    // 추후 삭제를 위하여 파일모드 변경
    imagedestroy($src);
    imagedestroy($dst);
    return basename($thumb_file);
}
开发者ID:kwon0281m,项目名称:gnuboard5,代码行数:101,代码来源:thumbnail.lib.php

示例4: readfile

        }
    }
}
$im = @ImageCreateFromJPEG($img) or $im = @ImageCreateFromPNG($img) or $im = @ImageCreateFromGIF($img) or $im = false;
// If image is not JPEG, PNG, or GIF
if (!$im) {
    // We get errors from PHP's ImageCreate functions...
    // So let's echo back the contents of the actual image.
    readfile($img);
} else {
    // Create the resized image destination
    $thumb = @ImageCreateTrueColor($w, $h);
    // Copy from image source, resize it, and paste to image destination
    @ImageCopyResampled($thumb, $im, 0, 0, 0, 0, $w, $h, $sw, $sh);
    if ($unsharp == 1) {
        $thumb = UnsharpMask($thumb, 100, 0.8, 2);
    }
    // Output resized image
    @ImageJPEG($thumb);
}
/*
New: 
- In version 2.1 (February 26 2007) Tom Bishop has done some important speed enhancements.
- From version 2 (July 17 2006) the script uses the imageconvolution function in PHP 
version >= 5.1, which improves the performance considerably.
Unsharp masking is a traditional darkroom technique that has proven very suitable for 
digital imaging. The principle of unsharp masking is to create a blurred copy of the image
and compare it to the underlying original. The difference in colour values
between the two images is greatest for the pixels near sharp edges. When this 
difference is subtracted from the original image, the edges will be
accentuated. 
开发者ID:bcampbell,项目名称:journalisted,代码行数:31,代码来源:imgsize.php

示例5: MakeThumbnail

function MakeThumbnail($upfiledir, $src, $tName, $tw = '', $th = '', $scale = true, $tDir = "thumb")
{
    global $iCMS;
    $R = array();
    $image = "";
    $tMap = array(1 => 'gif', 2 => 'jpeg', 3 => 'png');
    $tw = empty($tw) ? (int) $iCMS->config['thumbwidth'] : $tw;
    $th = empty($th) ? (int) $iCMS->config['thumbhight'] : $th;
    if ($tw && $th) {
        list($width, $height, $type) = @getimagesize($src);
        if ($width < 1 && $height < 1) {
            $R['width'] = $tw;
            $R['height'] = $th;
            $R['src'] = $src;
            return $R;
        }
        if ($width > $tw || $height > $th) {
            createdir($upfiledir . $tDir);
            if ($scale) {
                $im = scale_image(array("mw" => $tw, "mh" => $th, "cw" => $width, "ch" => $height));
            } else {
                $im = array('w' => $tw, 'h' => $th);
            }
            $R['width'] = $im['w'];
            $R['height'] = $im['h'];
            $tName .= '_' . $R['width'] . 'x' . $R['height'];
            $img = icf($tMap[$type], $src);
            if ($img['res']) {
                $thumb = imagecreatetruecolor($im['w'], $im['h']);
                imagecopyresampled($thumb, $img['res'], 0, 0, 0, 0, $im['w'], $im['h'], $width, $height);
                PHP_VERSION != '4.3.2' && UnsharpMask($thumb);
                $R['src'] = $upfiledir . $tDir . "/" . $tName;
                __image($thumb, $img['type'], $R['src']);
                $R['src'] .= '.' . $img['type'];
            } else {
                $R['src'] = $src;
            }
        } else {
            $R['width'] = $width;
            $R['height'] = $height;
            $R['src'] = $src;
        }
        return $R;
    }
}
开发者ID:jonycookie,项目名称:projectm2,代码行数:45,代码来源:common.php

示例6: UnsharpMask

            $pseudo_pic_height = $pic_height;
            $a = 0;
            $b = 0;
            $x = 0;
            $y = 0;
        }
    }
}
$thumbnail = $album_config['gd_version'] == 1 ? @imagecreate($thumbnail_width, $thumbnail_height) : @imagecreatetruecolor($thumbnail_width, $thumbnail_height);
$resize_function = $album_config['gd_version'] == 1 ? 'imagecopyresized' : 'imagecopyresampled';
@$resize_function($thumbnail, $src, $a, $b, $x, $y, $thumbnail_width, $thumbnail_height, $pseudo_pic_width, $pseudo_pic_height);
if ($sharpen == 1) {
    $amount = $album_config['sharpen_amount'];
    $radius = $album_config['sharpen_radius'];
    $threshold = $album_config['sharpen_threshold'];
    $thumbnail = UnsharpMask($thumbnail, $amount, $radius, $threshold);
}
if ($raster == 1) {
    if ($album_config['raster_line_color'] == "") {
        $album_config['raster_line_color'] == "000000";
    }
    $col = $album_config['raster_line_color'];
    $col = ImageColorAllocateHEX($thumbnail, $col);
    for ($i = 0; $i < $thumbnail_height + 1; $i++) {
        ImageLine($thumbnail, 1, $i, $thumbnail_width - 1, $i, $col);
        $i++;
    }
}
if ($colorize == 1) {
    $border_value = 0;
    $border2_value = 0;
开发者ID:wrtcoder,项目名称:mini_isp,代码行数:31,代码来源:auction_thumbnail_pro.php

示例7: generate_thumbnail

function generate_thumbnail($attach_thumb = array())
{
    global $options, $attachsubdir;
    $return = array();
    $image = '';
    $thumb_file = $attach_thumb['filepath'];
    $remap = array(1 => 'gif', 2 => 'jpg', 3 => 'png');
    if ($attach_thumb['thumbswidth'] && $attach_thumb['thumbsheight']) {
        $filesize = @GetImageSize($thumb_file);
        if ($filesize[0] < 1 && $filesize[1] < 1) {
            $filesize = array();
            $filesize[0] = $attach_thumb['thumbswidth'];
            $filesize[1] = $attach_thumb['thumbsheight'];
            $return['thumbwidth'] = $attach_thumb['thumbswidth'];
            $return['thumbheight'] = $attach_thumb['thumbsheight'];
            $return['thumbfilepath'] = $attach_thumb['filepath'];
            return $return;
        }
        if ($filesize[0] > $thumb['thumbswidth'] || $filesize[1] > $attach_thumb['thumbsheight']) {
            $im = scale_image(array('max_width' => $attach_thumb['thumbswidth'], 'max_height' => $attach_thumb['thumbsheight'], 'cur_width' => $filesize[0], 'cur_height' => $filesize[1]));
            $return['thumbwidth'] = $im['img_width'];
            $return['thumbheight'] = $im['img_height'];
            if ($remap[$filesize[2]] == 'gif') {
                if (function_exists('imagecreatefromgif')) {
                    if (!($image = @imagecreatefromgif($thumb_file))) {
                        redirect($attach_thumb['filename'] . '文件生成缩略图失败');
                    }
                    $type = 'gif';
                }
            } else {
                if ($remap[$filesize[2]] == 'png') {
                    if (function_exists('imagecreatefrompng')) {
                        if (!($image = @imagecreatefrompng($thumb_file))) {
                            redirect($attach_thumb['filename'] . '文件生成缩略图失败');
                        }
                        $type = 'png';
                    }
                } else {
                    if ($remap[$filesize[2]] == 'jpg') {
                        if (function_exists('imagecreatefromjpeg')) {
                            if (!($image = @imagecreatefromjpeg($thumb_file))) {
                                redirect($attach_thumb['filename'] . '文件生成缩略图失败');
                            }
                            $type = 'jpg';
                        }
                    }
                }
            }
            if ($image) {
                if (function_exists('imagecreatetruecolor')) {
                    $thumb = @imagecreatetruecolor($im['img_width'], $im['img_height']);
                    @imagecopyresampled($thumb, $image, 0, 0, 0, 0, $im['img_width'], $im['img_height'], $filesize[0], $filesize[1]);
                } else {
                    $thumb = @imagecreate($im['img_width'], $im['img_height']);
                    @imagecopyresized($thumb, $image, 0, 0, 0, 0, $im['img_width'], $im['img_height'], $filesize[0], $filesize[1]);
                }
                if (PHP_VERSION != '4.3.2') {
                    UnsharpMask($thumb);
                }
                if (!$thumb_filename) {
                    $thumb_filename = 'thumb_' . $attach_thumb['filename'];
                }
                $file_extension = $attach_thumb['extension'];
                if ($file_extension == 'jpg' && function_exists('imagejpeg')) {
                    @imagejpeg($thumb, SABLOG_ROOT . $options['attachments_dir'] . $attach_thumb['attachsubdir'] . $thumb_filename . '.jpg', 80);
                    @imagedestroy($thumb);
                } else {
                    if ($file_extension == 'png' && function_exists('imagepng')) {
                        @imagepng($thumb, SABLOG_ROOT . $options['attachments_dir'] . $attach_thumb['attachsubdir'] . $thumb_filename . '.png');
                        @imagedestroy($thumb);
                    } else {
                        if ($file_extension == 'gif' && function_exists('imagegif')) {
                            @imagegif($thumb, SABLOG_ROOT . $options['attachments_dir'] . $attach_thumb['attachsubdir'] . $thumb_filename . '.gif');
                            @imagedestroy($thumb);
                        } else {
                            $return['thumbfilepath'] = $thumb['filepath'];
                            return $return;
                        }
                    }
                }
                $return['thumbfilepath'] = $thumb_filename . '.' . $file_extension;
                return $return;
            } else {
                $return['thumbwidth'] = $im['img_width'];
                $return['thumbheight'] = $im['img_height'];
                $return['thumbfilepath'] = $attach_thumb['filepath'];
                return $return;
            }
        } else {
            $return['thumbwidth'] = $filesize[0];
            $return['thumbheight'] = $filesize[1];
            $return['thumbfilepath'] = $attach_thumb['filepath'];
            return $return;
        }
    }
}
开发者ID:BGCX261,项目名称:zjnewcitycode-svn-to-git,代码行数:96,代码来源:attachment.func.php

示例8: explode

/**
 * Check if any effect needs to be applied to the thumbnail
 */
/** Add Unsharp */
if ($_GET['sh']) {
    if ($_GET['sh'] == 1) {
        $cant = 70;
        $radio = 0.5;
        $thres = 3;
    } else {
        $arraysh = explode("|", $_GET['sh']);
        $cant = $arraysh[0];
        $radio = $arraysh[1];
        $thres = $arraysh[2];
    }
    UnsharpMask($output, $cant, $radio, $thres);
}
/** Rotate */
if ($_GET['r']) {
    $arrayr = explode("|", $_GET['r']);
    $grados = $arrayr[0];
    $back = '0x' . $arrayr[1];
    $rotate = imagerotate($output, $grados, $back);
    imagejpeg($rotate, NULL, $thumbnail_quality);
}
/** Add Blur */
if ($_GET['bl']) {
    $blcant = $_GET['bl'];
    blur($output, $blcant);
}
/** Add Pixelate */
开发者ID:google-code-backups,项目名称:clients-oriented-ftp,代码行数:31,代码来源:thumb.php

示例9: makeThumbnailFullUnsharpMask

function makeThumbnailFullUnsharpMask($vb798abe6e1b1318ee36b0dcb3fb9e4d3, $ve9f40e1f1d1658681dad2dac4ae0971e, $vfc021d54683383e5078ab9fefc4d53c8, $vf0598264a691a8f62272aca0e79af374)
{
    if (function_exists('UnsharpMask')) {
        return UnsharpMask($vb798abe6e1b1318ee36b0dcb3fb9e4d3, $ve9f40e1f1d1658681dad2dac4ae0971e, $vfc021d54683383e5078ab9fefc4d53c8, $vf0598264a691a8f62272aca0e79af374);
    } else {
        if ($ve9f40e1f1d1658681dad2dac4ae0971e > 500) {
            $ve9f40e1f1d1658681dad2dac4ae0971e = 500;
        }
        $ve9f40e1f1d1658681dad2dac4ae0971e = $ve9f40e1f1d1658681dad2dac4ae0971e * 0.016;
        if ($vfc021d54683383e5078ab9fefc4d53c8 > 50) {
            $vfc021d54683383e5078ab9fefc4d53c8 = 50;
        }
        $vfc021d54683383e5078ab9fefc4d53c8 = $vfc021d54683383e5078ab9fefc4d53c8 * 2;
        if ($vf0598264a691a8f62272aca0e79af374 > 255) {
            $vf0598264a691a8f62272aca0e79af374 = 255;
        }
        $vfc021d54683383e5078ab9fefc4d53c8 = abs(round($vfc021d54683383e5078ab9fefc4d53c8));
        if ($vfc021d54683383e5078ab9fefc4d53c8 == 0) {
            return $vb798abe6e1b1318ee36b0dcb3fb9e4d3;
            imagedestroy($vb798abe6e1b1318ee36b0dcb3fb9e4d3);
            break;
        }
        $vf1290186a5d0b1ceab27f4e77c0c5d68 = imagesx($vb798abe6e1b1318ee36b0dcb3fb9e4d3);
        $v2510c39011c5be704182423e3a695e91 = imagesy($vb798abe6e1b1318ee36b0dcb3fb9e4d3);
        $vdd2b9c2d0f89eb88267d945e852649e1 = $vb798abe6e1b1318ee36b0dcb3fb9e4d3;
        $v731eea25c6c42b949dd8b33e55cb622e = $vb798abe6e1b1318ee36b0dcb3fb9e4d3;
        $v0912bfe735bcb6f63b4dc49ae3833df8 = imagecreatetruecolor($vf1290186a5d0b1ceab27f4e77c0c5d68, $v2510c39011c5be704182423e3a695e91);
        for ($v865c0c0b4ab0e063e5caa3387c1a8741 = 0; $v865c0c0b4ab0e063e5caa3387c1a8741 < $vfc021d54683383e5078ab9fefc4d53c8; $v865c0c0b4ab0e063e5caa3387c1a8741++) {
            imagecopy($v0912bfe735bcb6f63b4dc49ae3833df8, $vdd2b9c2d0f89eb88267d945e852649e1, 0, 0, 1, 1, $vf1290186a5d0b1ceab27f4e77c0c5d68 - 1, $v2510c39011c5be704182423e3a695e91 - 1);
            imagecopymerge($v0912bfe735bcb6f63b4dc49ae3833df8, $vdd2b9c2d0f89eb88267d945e852649e1, 1, 1, 0, 0, $vf1290186a5d0b1ceab27f4e77c0c5d68, $v2510c39011c5be704182423e3a695e91, 50);
            imagecopymerge($v0912bfe735bcb6f63b4dc49ae3833df8, $vdd2b9c2d0f89eb88267d945e852649e1, 0, 1, 1, 0, $vf1290186a5d0b1ceab27f4e77c0c5d68 - 1, $v2510c39011c5be704182423e3a695e91, 33.33333);
            imagecopymerge($v0912bfe735bcb6f63b4dc49ae3833df8, $vdd2b9c2d0f89eb88267d945e852649e1, 1, 0, 0, 1, $vf1290186a5d0b1ceab27f4e77c0c5d68, $v2510c39011c5be704182423e3a695e91 - 1, 25);
            imagecopymerge($v0912bfe735bcb6f63b4dc49ae3833df8, $vdd2b9c2d0f89eb88267d945e852649e1, 0, 0, 1, 0, $vf1290186a5d0b1ceab27f4e77c0c5d68 - 1, $v2510c39011c5be704182423e3a695e91, 33.33333);
            imagecopymerge($v0912bfe735bcb6f63b4dc49ae3833df8, $vdd2b9c2d0f89eb88267d945e852649e1, 1, 0, 0, 0, $vf1290186a5d0b1ceab27f4e77c0c5d68, $v2510c39011c5be704182423e3a695e91, 25);
            imagecopymerge($v0912bfe735bcb6f63b4dc49ae3833df8, $vdd2b9c2d0f89eb88267d945e852649e1, 0, 0, 0, 1, $vf1290186a5d0b1ceab27f4e77c0c5d68, $v2510c39011c5be704182423e3a695e91 - 1, 20);
            imagecopymerge($v0912bfe735bcb6f63b4dc49ae3833df8, $vdd2b9c2d0f89eb88267d945e852649e1, 0, 1, 0, 0, $vf1290186a5d0b1ceab27f4e77c0c5d68, $v2510c39011c5be704182423e3a695e91, 16.666667);
            imagecopymerge($v0912bfe735bcb6f63b4dc49ae3833df8, $vdd2b9c2d0f89eb88267d945e852649e1, 0, 0, 0, 0, $vf1290186a5d0b1ceab27f4e77c0c5d68, $v2510c39011c5be704182423e3a695e91, 50);
        }
        $vdd2b9c2d0f89eb88267d945e852649e1 = $v0912bfe735bcb6f63b4dc49ae3833df8;
        for ($v9dd4e461268c8034f5c8564e155c67a6 = 0; $v9dd4e461268c8034f5c8564e155c67a6 < $vf1290186a5d0b1ceab27f4e77c0c5d68; $v9dd4e461268c8034f5c8564e155c67a6++) {
            for ($v415290769594460e2e485922904f345d = 0; $v415290769594460e2e485922904f345d < $v2510c39011c5be704182423e3a695e91; $v415290769594460e2e485922904f345d++) {
                $ve7ee80f9d3ee77a07b7e0e40911d4b85 = ImageColorAt($v731eea25c6c42b949dd8b33e55cb622e, $v9dd4e461268c8034f5c8564e155c67a6, $v415290769594460e2e485922904f345d);
                $vcd8a4c8c79b1ff2c064026bb7cefe760 = $ve7ee80f9d3ee77a07b7e0e40911d4b85 >> 16 & 0xff;
                $vd7fd33dc47e7db31c2bdd232804331bf = $ve7ee80f9d3ee77a07b7e0e40911d4b85 >> 8 & 0xff;
                $v62f533cdf0bda50d31d41662bbe16e8e = $ve7ee80f9d3ee77a07b7e0e40911d4b85 & 0xff;
                $v82d175da0ae7901210ea5d63914f5212 = ImageColorAt($vdd2b9c2d0f89eb88267d945e852649e1, $v9dd4e461268c8034f5c8564e155c67a6, $v415290769594460e2e485922904f345d);
                $v56dc21b41aac91a611402ee281442e54 = $v82d175da0ae7901210ea5d63914f5212 >> 16 & 0xff;
                $vab27a9c8dd988ea5d32cd8f3e763b1b1 = $v82d175da0ae7901210ea5d63914f5212 >> 8 & 0xff;
                $vfbdaa5229703cc85625873f73f1ef573 = $v82d175da0ae7901210ea5d63914f5212 & 0xff;
                $v6c99f2ac4dbbc9ac99a83340dacd50cb = abs($vcd8a4c8c79b1ff2c064026bb7cefe760 - $v56dc21b41aac91a611402ee281442e54) >= $vf0598264a691a8f62272aca0e79af374 ? max(0, min(255, $ve9f40e1f1d1658681dad2dac4ae0971e * ($vcd8a4c8c79b1ff2c064026bb7cefe760 - $v56dc21b41aac91a611402ee281442e54) + $vcd8a4c8c79b1ff2c064026bb7cefe760)) : $vcd8a4c8c79b1ff2c064026bb7cefe760;
                $v8f3e420d187de004189e440099d8e9b8 = abs($vd7fd33dc47e7db31c2bdd232804331bf - $vab27a9c8dd988ea5d32cd8f3e763b1b1) >= $vf0598264a691a8f62272aca0e79af374 ? max(0, min(255, $ve9f40e1f1d1658681dad2dac4ae0971e * ($vd7fd33dc47e7db31c2bdd232804331bf - $vab27a9c8dd988ea5d32cd8f3e763b1b1) + $vd7fd33dc47e7db31c2bdd232804331bf)) : $vd7fd33dc47e7db31c2bdd232804331bf;
                $v4798968467b4ab45ea7902a5084666b8 = abs($v62f533cdf0bda50d31d41662bbe16e8e - $vfbdaa5229703cc85625873f73f1ef573) >= $vf0598264a691a8f62272aca0e79af374 ? max(0, min(255, $ve9f40e1f1d1658681dad2dac4ae0971e * ($v62f533cdf0bda50d31d41662bbe16e8e - $vfbdaa5229703cc85625873f73f1ef573) + $v62f533cdf0bda50d31d41662bbe16e8e)) : $v62f533cdf0bda50d31d41662bbe16e8e;
                if ($vcd8a4c8c79b1ff2c064026bb7cefe760 != $v6c99f2ac4dbbc9ac99a83340dacd50cb || $vd7fd33dc47e7db31c2bdd232804331bf != $v8f3e420d187de004189e440099d8e9b8 || $v62f533cdf0bda50d31d41662bbe16e8e != $v4798968467b4ab45ea7902a5084666b8) {
                    $vfbfe459f582d8ac5384527d6aaadb670 = ImageColorAllocate($vb798abe6e1b1318ee36b0dcb3fb9e4d3, $v6c99f2ac4dbbc9ac99a83340dacd50cb, $v8f3e420d187de004189e440099d8e9b8, $v4798968467b4ab45ea7902a5084666b8);
                    ImageSetPixel($vb798abe6e1b1318ee36b0dcb3fb9e4d3, $v9dd4e461268c8034f5c8564e155c67a6, $v415290769594460e2e485922904f345d, $vfbfe459f582d8ac5384527d6aaadb670);
                }
            }
        }
        return $vb798abe6e1b1318ee36b0dcb3fb9e4d3;
    }
}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:61,代码来源:lib.php

示例10: imagecreatefromgif

         case "gif":
             $fullImage = imagecreatefromgif($_FILES['uploaded_file']['tmp_name']);
             break;
         default:
             $fullImage = imagecreatefromjpeg($_FILES['uploaded_file']['tmp_name']);
             break;
     }
     $scale = 1;
     if ($fullSize[0] > $fullSize[1]) {
         $scale = $fullSize[0] / $tsetting["max_width"];
     } else {
         $scale = $fullSize[1] / $tsetting["max_height"];
     }
     $tnImage = imagecreatetruecolor($fullSize[0] / $scale, $fullSize[1] / $scale);
     imagecopyresampled($tnImage, $fullImage, 0, 0, 0, 0, $fullSize[0] / $scale, $fullSize[1] / $scale, $fullSize[0], $fullSize[1]);
     $tnImage = UnsharpMask($tnImage, 80, 0.5, 3);
     switch ($ext) {
         case "png":
             imagepng($tnImage, dirname(__FILE__) . $upload_folder . "\\" . $filen . $tsetting["suffix"] . ".png");
             break;
         case "gif":
             imagegif($tnImage, dirname(__FILE__) . $upload_folder . "\\" . $filen . $tsetting["suffix"] . ".gif");
             break;
         default:
             imagejpeg($tnImage, dirname(__FILE__) . $upload_folder . "\\" . $filen . $tsetting["suffix"] . "." . $ext);
             break;
     }
     imagedestroy($tnImage);
 } else {
     //do not create thumbs...
     $thumb_url = $final_url;
开发者ID:ShashangkaShekhar,项目名称:MCQ-Systems-PHP,代码行数:31,代码来源:upload.php

示例11: code


//.........这里部分代码省略.........
        $params['hint'] = true;
    }
    if (!isset($params['extrapolate'])) {
        $params['extrapolate'] = true;
    }
    if (!isset($params['dev'])) {
        $params['dev'] = false;
    }
    if (!isset($params['crop'])) {
        $params['crop'] = true;
    }
    if (!isset($params['width']) && !isset($params['height']) && !isset($params['longside']) && !isset($params['shortside'])) {
        $params['width'] = 100;
    }
    // have a look at the params for debugging purposes
    // return "<pre>" . print_r($params,1) . "</pre>";
    // defining these prevents warnings
    $_SRC = array();
    $_DST = array();
    $_DST['offset_w'] = 0;
    $_DST['offset_h'] = 0;
    // Start time measurement
    if ($params['dev']) {
        if (!function_exists('getmicrotime')) {
            function getmicrotime()
            {
                list($usec, $sec) = explode(" ", microtime());
                return (double) $usec + (double) $sec;
            }
        }
        $time['start'] = getmicrotime();
    }
    // Funktion zum Schärfen
    if (!function_exists('UnsharpMask')) {
        // Unsharp mask algorithm by Torstein Hønsi 2003 (thoensi_at_netcom_dot_no)
        // Christoph Erdmann: changed it a little, cause i could not reproduce the darker blurred image, now it is up to 15% faster with same results
        function UnsharpMask($img, $amount, $radius, $threshold)
        {
            // Attempt to calibrate the parameters to Photoshop:
            if ($amount > 500) {
                $amount = 500;
            }
            $amount = $amount * 0.016;
            if ($radius > 50) {
                $radius = 50;
            }
            $radius = $radius * 2;
            if ($threshold > 255) {
                $threshold = 255;
            }
            $radius = abs(round($radius));
            // Only integers make sense.
            if ($radius == 0) {
                return $img;
                imagedestroy($img);
                break;
            }
            $w = imagesx($img);
            $h = imagesy($img);
            $imgCanvas = $img;
            $imgCanvas2 = $img;
            $imgBlur = imagecreatetruecolor($w, $h);
            // Gaussian blur matrix:
            //	1	2	1
            //	2	4	2
            //	1	2	1
开发者ID:mymizan,项目名称:phreeze,代码行数:67,代码来源:function.thumb.php

示例12: j_make_image

function j_make_image($in_name, $out_name, $sz = array(), $use_reg = true)
{
    // контекст картинки по умолчанию
    if ($use_reg) {
        if (!$GLOBALS[REG]->get_section('/system/pics', $sz_reg)) {
            set_error_ex('Unspecified picture proportions!', SYS_ERR);
            return '';
        }
        $sz = array_merge($sz_reg, $sz);
    }
    $tmp = $in_name;
    //echo $tmp.' '. file_exists($tmp);
    $inf = @getimagesize($tmp);
    if (empty($inf) || $inf[2] < 1 || $inf[2] > 3) {
        return false;
    }
    switch ($inf[2]) {
        case 1:
            $img = ImageCreateFromGIF($tmp);
            break;
        case 2:
            $img = ImageCreateFromJPEG($tmp);
            break;
        case 3:
            $img = ImageCreateFromPNG($tmp);
            break;
    }
    // prepare pic name
    if (empty($out_name) || !empty($sz['no_pic']) && $out_name == $sz['no_pic']) {
        $out_name = uniqid('img', false);
    }
    //Detect quality
    if (empty($sz['quality'])) {
        $sz['quality'] = 100;
    }
    //JOHN Генерация имен, фикс тумбнейла
    if (empty($sz['pic_nm'])) {
        $sz['pic_nm'] = '{name}';
    }
    if (empty($sz['tmb_nm'])) {
        $sz['tmb_nm'] = 'thumb_{name}';
    }
    if (!isset($sz['pic_fix'])) {
        $sz['pic_fix'] = -1;
    }
    if (!isset($sz['tmb_fix'])) {
        $sz['tmb_fix'] = -1;
    }
    if (isset($sz['unsharp']) && (int) $sz['unsharp'] < 50) {
        $sz['unsharp'] = 100;
    }
    // process  tumbnail
    $i = min($sz['tmb_x'], $sz['tmb_y']);
    if ($i > 0) {
        //Вычисление пропорций
        $dx = $inf[0] / $sz['tmb_x'];
        $dy = $inf[1] / $sz['tmb_y'];
        if ($inf[0] >= $inf[1]) {
            $pt = 'l';
        } else {
            $pt = 'p';
        }
        $sides = array('x', 'y');
        if ($sz['tmb_fix'] < 0) {
            $mpl = min($dx, $dy);
        } else {
            $mpl = $inf[$sz['tmb_fix']] / $sz['tmb_' . $sides[$sz['tmb_fix']]];
        }
        //Размеры превью
        $x = (int) $inf[0] / $mpl;
        $y = (int) $inf[1] / $mpl;
        // Создаю временные имеджи
        $tmb = ImageCreateTrueColor($x, $y);
        //$tmb=ImageCreateTrueColor($sz['tmb_x'],$sz['tmb_y']);
        if ($sz['tmb_fix'] < 0) {
            // find x,y and crop
            $px = (int) ($x - $sz['tmb_x']) / 2;
            $py = (int) ($y - $sz['tmb_y']) / 2;
        } else {
            $px = $py = 0;
        }
        // Масштабирую превью
        ImageCopyResampled($tmb, $img, 0, 0, $px, $py, $x, $y, $inf[0], $inf[1]);
        // save tumbnail
        $path = sprintf('%s/%s', $sz['path'], str_replace('{name}', $out_name, $sz['tmb_nm']) . '.jpg');
        if (!empty($sz['unsharp'])) {
            $tmb = UnsharpMask($tmb, (int) ($sz['unsharp'] * 2 / ($inf[0] / $x)), 0.5, 0);
        }
        ImageJPEG($tmb, $path, $sz['quality']);
    }
    // ПРоверка параметров
    $i = min($sz['pic_px'], $sz['pic_py'], $sz['pic_lx'], $sz['pic_ly']);
    // if -1 do nothing
    if ($i < 1) {
        return $out_name;
    }
    //Проверить, если картинка меньше чем нужно в настройке - ниче не делать
    if ($inf[0] > $inf[1]) {
        $cs = $inf[0];
        $p = 'lx';
//.........这里部分代码省略.........
开发者ID:kronius,项目名称:vidpro,代码行数:101,代码来源:controls.php

示例13: thumbnail


//.........这里部分代码省略.........
     $src_h = $size[1];
     $dst_w = $keep_origin ? $src_w : $thumb_width;
     $dst_h = $keep_origin ? $src_h : $thumb_height;
     $ratio = $dst_h / $dst_w;
     if ($is_large) {
         // 크롭처리
         if ($is_crop) {
             switch ($crop_mode) {
                 case 'center':
                     if ($size[1] / $size[0] >= $ratio) {
                         $src_h = round($src_w * $ratio);
                         $src_y = round(($size[1] - $src_h) / 2);
                     } else {
                         $src_w = round($size[1] / $ratio);
                         $src_x = round(($size[0] - $src_w) / 2);
                     }
                     break;
                 default:
                     if ($size[1] / $size[0] >= $ratio) {
                         $src_h = round($src_w * $ratio);
                     } else {
                         $src_w = round($size[1] / $ratio);
                     }
                     break;
             }
         }
         $dst = imagecreatetruecolor($dst_w, $dst_h);
         if ($size[2] === 3) {
             imagealphablending($dst, false);
             imagesavealpha($dst, true);
         } elseif ($size[2] === 1) {
             $palletsize = imagecolorstotal($src);
             if ($src_transparency >= 0 && $src_transparency < $palletsize) {
                 $transparent_color = imagecolorsforindex($src, $src_transparency);
                 $current_transparent = imagecolorallocate($dst, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']);
                 imagefill($dst, 0, 0, $current_transparent);
                 imagecolortransparent($dst, $current_transparent);
             }
         }
     } else {
         $dst = imagecreatetruecolor($dst_w, $dst_h);
         $bgcolor = imagecolorallocate($dst, 255, 255, 255);
         // 배경색
         if ($src_w < $dst_w) {
             if ($src_h >= $dst_h) {
                 $dst_x = round(($dst_w - $src_w) / 2);
                 $src_h = $dst_h;
             } else {
                 $dst_x = round(($dst_w - $src_w) / 2);
                 $dst_y = round(($dst_h - $src_h) / 2);
                 $dst_w = $src_w;
                 $dst_h = $src_h;
             }
         } else {
             if ($src_h < $dst_h) {
                 $dst_y = round(($dst_h - $src_h) / 2);
                 $dst_h = $src_h;
                 $src_w = $dst_w;
             }
         }
         if ($size[2] === 3) {
             $bgcolor = imagecolorallocatealpha($dst, 0, 0, 0, 127);
             imagefill($dst, 0, 0, $bgcolor);
             imagealphablending($dst, false);
             imagesavealpha($dst, true);
         } elseif ($size[2] === 1) {
             $palletsize = imagecolorstotal($src);
             if ($src_transparency >= 0 && $src_transparency < $palletsize) {
                 $transparent_color = imagecolorsforindex($src, $src_transparency);
                 $current_transparent = imagecolorallocate($dst, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']);
                 imagefill($dst, 0, 0, $current_transparent);
                 imagecolortransparent($dst, $current_transparent);
             } else {
                 imagefill($dst, 0, 0, $bgcolor);
             }
         } else {
             imagefill($dst, 0, 0, $bgcolor);
         }
     }
     imagecopyresampled($dst, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
     // sharpen 적용
     if ($is_sharpen && $is_large) {
         $val = explode('/', $um_value);
         UnsharpMask($dst, $val[0], $val[1], $val[2]);
     }
     if ($size[2] === 1) {
         imagegif($dst, $thumb_file);
     } elseif ($size[2] === 3) {
         $png_compress = 5;
         imagepng($dst, $thumb_file, $png_compress);
     } else {
         $jpg_quality = 90;
         imagejpeg($dst, $thumb_file, $jpg_quality);
     }
     chmod($thumb_file, 0644);
     // 추후 삭제를 위하여 파일모드 변경
     imagedestroy($src);
     imagedestroy($dst);
     return $thumb_file;
 }
开发者ID:smboy86,项目名称:zzing,代码行数:101,代码来源:thumbnail_helper.php

示例14: ResizeCropper

 function ResizeCropper($file, $dimensions, $cropinfo, &$annotation)
 {
     global $C;
     $this->PrepareImageInfo($file, $dimensions);
     $img_src = @imagecreatefromjpeg($file);
     $img_dst = @imagecreatetruecolor($this->new_width, $this->new_height);
     $img_height = imagesy($img_src);
     $img_width = imagesx($img_src);
     // Resize and crop
     @imagecopyresampled($img_dst, $img_src, 0, 0, round($cropinfo['x']), round($cropinfo['y']), $this->new_width, $this->new_height, min($img_width, $cropinfo['width']), min($img_height, $cropinfo['height']));
     @imagedestroy($img_src);
     // Apply unsharp mask
     UnsharpMask($img_dst, 60, 0.5, 2);
     // Apply the annotation
     $this->DoAnnotate($img_dst, $annotation);
     // Save the image back to disk
     @imagejpeg($img_dst, $file, $C['compression']);
 }
开发者ID:Cyberspace-Networks,项目名称:TGPX,代码行数:18,代码来源:imager.class.php

示例15: resize_image


//.........这里部分代码省略.........
        case "gd2":
            if (!function_exists('imagecreatefromjpeg')) {
                return array('error' => 'PHP running on your server does not support the GD image library, check with your webhost if ImageMagick is installed', 'halt_upload' => 1);
            }
            if (!function_exists('imagecreatetruecolor')) {
                return array('error' => 'PHP running on your server does not support GD version 2.x, please switch to GD version 1.x on the admin page', 'halt_upload' => 1);
            }
            if ($imginfo[2] == GIS_GIF && $CONFIG['GIF_support'] == 1) {
                $src_img = imagecreatefromgif($src_file);
            } elseif ($imginfo[2] == GIS_JPG) {
                $src_img = imagecreatefromjpeg($src_file);
            } else {
                $src_img = imagecreatefrompng($src_file);
            }
            if (!$src_img) {
                $ERROR = $lang_errors['invalid_image'];
                //return false;
                return array('error' => $ERROR);
            }
            if ($imginfo[2] == GIS_GIF) {
                $dst_img = imagecreate($destWidth, $destHeight);
            } else {
                $dst_img = imagecreatetruecolor($destWidth, $destHeight);
                if ($imginfo[2] == GIS_PNG) {
                    imagealphablending($dst_img, false);
                }
            }
            imagecopyresampled($dst_img, $src_img, 0, 0, $xOffset, $yOffset, (int) $destWidth, (int) $destHeight, $srcWidth, $srcHeight);
            touch($dest_file);
            $fh = fopen($dest_file, 'w');
            fclose($fh);
            //sharpen the thumb
            if ($sharpen == 1 && $CONFIG['enable_unsharp'] == 1) {
                UnsharpMask($dst_img, $CONFIG['unsharp_amount'], $CONFIG['unsharp_radius'], $CONFIG['unsharp_threshold']);
            }
            if ($media_type != "false") {
                //if a manual thumb gets generated we watermark the thumb with the media type
                //we now need to get the absolute path to the thumb watermark files
                $path_parts = pathinfo($CONFIG['watermark_file']);
                $CONFIG['watermark_file'] = $path_parts["dirname"] . "/wm_" . $media_type . ".png";
            }
            if ($watermark == "true" || $media_type != "false") {
                //shrink watermark on intermediate images -> If I had known that this is that �%&# with the transparency preserve... grrr
                $wm_normal = (int) $CONFIG['reduce_watermark'];
                if ($wm_normal > $destWidth) {
                    $wm_resize = $destWidth / $wm_normal;
                    //load the original, huge sized logo (the one we want to size down)
                    $temp_logoImage = ImageCreateFromPNG($CONFIG['watermark_file']);
                    //get it's size
                    $temp_logoW = ImageSX($temp_logoImage);
                    $temp_logoH = ImageSY($temp_logoImage);
                    //calculate new size
                    $logoW = (int) ($temp_logoW * $wm_resize);
                    $logoH = (int) ($temp_logoH * $wm_resize);
                    //we create a new, resized logo
                    $logoImage = imagecreatetruecolor($logoW, $logoH);
                    //just to be sure that transparency gets preserved
                    imagealphablending($logoImage, FALSE);
                    imagealphablending($temp_logoImage, TRUE);
                    //now copy and resize the big one into the temp resized img
                    imagecopyresampled($logoImage, $temp_logoImage, 0, 0, 0, 0, (int) $logoW, (int) $logoH, $temp_logoW, $temp_logoH);
                    //we do not need the temp (huge) watermark anymore
                    imagedestroy($temp_logoImage);
                } else {
                    // shrink not enabled or no intermediate...
                    $logoImage = ImageCreateFromPNG($CONFIG['watermark_file']);
开发者ID:stephenjschaefer,项目名称:APlusPhotography,代码行数:67,代码来源:picmgmt.inc.php


注:本文中的UnsharpMask函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。