Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Sorry guys, after updating and for me has ceased to work with an early posted function, now I use this code, can try:
    ` /**
    * Fast imagecopyresampled by tim@leethost.com
    *
    */
    function fastimagecopyresampled (&$dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $quality = 3) {
    // Plug-and-Play fastimagecopyresampled function replaces much slower imagecopyresampled.
    // Just include this function and change all “imagecopyresampled” references to “fastimagecopyresampled”.
    // Typically from 30 to 60 times faster when reducing high resolution images down to thumbnail size using the default quality setting.
    // Author: Tim Eckel – Date: 12/17/04 – Project: FreeRingers.net – Freely distributable.
    //
    // Optional “quality” parameter (defaults is 3). Fractional values are allowed, for example 1.5.
    // 1 = Up to 600 times faster. Poor results, just uses imagecopyresized but removes black edges.
    // 2 = Up to 95 times faster. Images may appear too sharp, some people may prefer it.
    // 3 = Up to 60 times faster. Will give high quality smooth results very close to imagecopyresampled.
    // 4 = Up to 25 times faster. Almost identical to imagecopyresampled for most images.
    // 5 = No speedup. Just uses imagecopyresampled, highest quality but no advantage over imagecopyresampled.

    if (empty($src_image) || empty($dst_image)) { return false; }

    if ($quality <= 1) {
    $temp = imagecreatetruecolor ($dst_w + 1, $dst_h + 1);
    imagecopyresized ($temp, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w + 1, $dst_h + 1, $src_w, $src_h);
    imagecopyresized ($dst_image, $temp, 0, 0, 0, 0, $dst_w, $dst_h, $dst_w, $dst_h);
    imagedestroy ($temp);
    } elseif ($quality < 5 && (($dst_w * $quality) < $src_w || ($dst_h * $quality) < $src_h)) {
    $tmp_w = $dst_w * $quality;
    $tmp_h = $dst_h * $quality;
    // on whatever reason PHP 4.4.8 stopped here.
    $temp = imagecreatetruecolor ($tmp_w + 1, $tmp_h + 1);

    // *добавлено для прозрачности png*
    $dst_img = imagecreatetruecolor($dst_w, $dst_h);
    imagealphablending($dst_image, false);
    imagesavealpha($dst_image,true);
    $transparent = imagecolorallocatealpha($dst_image, 255, 255, 255, 127);
    imagefilledrectangle($dst_image, 0, 0, $dst_w, $dst_h, $transparent);
    //**
    imagecopyresized ($temp, $src_image, $dst_x * $quality, $dst_y * $quality, $src_x, $src_y, $tmp_w + 1, $tmp_h + 1, $src_w, $src_h);
    imagecopyresampled ($dst_image, $temp, 0, 0, 0, 0, $dst_w, $dst_h, $tmp_w, $tmp_h);
    imagedestroy ($temp);
    } else {
    //*добавлено для прозрачности png*
    $dst_img = imagecreatetruecolor($dst_w, $dst_h);
    imagealphablending($dst_image, false);
    imagesavealpha($dst_image,true);
    $transparent = imagecolorallocatealpha($dst_image, 255, 255, 255, 127);
    imagefilledrectangle($dst_image, 0, 0, $dst_w, $dst_h, $transparent);
    //**
    imagecopyresampled($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
    }
    return true;
    }`

    Hi Cemal.
    I hope this code help you. You need to edit public_html/wp-content/plugins/nextgen-gallery/lib/gd.thumbnail.inc.php, comment native code of function fastimagecopyresampled and pun this code:

    function fastimagecopyresampled (&$dst_image, $src_image, `$dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $quality = 5) {
    $dst_img = imagecreatetruecolor($dst_w, $dst_h);
    imagealphablending($dst_image, false);
    imagesavealpha($dst_image,true);
    $transparent = imagecolorallocatealpha($dst_image, 255, 255, 255, 127);
    imagefilledrectangle($dst_image, 0, 0, $dst_w, $dst_h, $transparent);
    imagecopyresampled($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
    return true;
    }`

    After you must reset (clean) images cache in NG settings

    @oranblackwell,
    Thanks for the posts…
    Andrey

Viewing 3 replies - 1 through 3 (of 3 total)