Plugin Directory

Changeset 3410991


Ignore:
Timestamp:
12/04/2025 01:29:29 PM (4 months ago)
Author:
rainafarai
Message:

Fixed an issue where non-transparent images were incorrectly detected as transparent.

Location:
raina-image-compression
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • raina-image-compression/tags/1.8.2/raina-image-compression.php

    r3405323 r3410991  
    44* Description: Raina Image Compression automatically optimizes JPG, PNG, and WebP images on upload for faster, cleaner websites. It resizes, converts, and compresses images without losing quality — all handled locally, with no external services required.
    55* Plugin URI: https://www.reggae.it/my-wordpress-plugins
    6 * Version: 1.8
     6* Version: 1.8.2
    77* Requires at least: 5.6
    88* Requires PHP: 7.4
     
    593593    $h = imagesy($img);
    594594
    595 
    596 
    597     for ($x = 0; $x < $w; $x++) {
    598         for ($y = 0; $y < $h; $y++) {
    599             $rgba  = imagecolorat($img, $x, $y);
    600             $alpha = ($rgba & 0x7F000000) >> 24; // 0 = opaco, 127 = totalmente trasparente
     595    // Campionamento ogni 4 pixel per accelerare
     596    $step = 4;
     597
     598    for ($x = 0; $x < $w; $x += $step) {
     599        for ($y = 0; $y < $h; $y += $step) {
     600
     601            $rgba = imagecolorat($img, $x, $y);
     602            $alpha = ($rgba & 0x7F000000) >> 24;
     603
     604            // Pixel realmente trasparente?
    601605            if ($alpha > 0) {
    602                 return true; // Trova trasparenza
     606                return true;
    603607            }
    604608        }
    605609    }
    606     return false; // Nessuna trasparenza
    607 }
     610
     611    return false;
     612}
     613
    608614
    609615
  • raina-image-compression/tags/1.8.2/readme.txt

    r3405323 r3410991  
    44Tags: image compression, image optimization, webp, jpg, png
    55Tested up to: 6.8
    6 Stable tag: 1.8
     6Stable tag: 1.8.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    1131134. Admin bar toggle for quick enable/disable.
    1141145. Outputfile Options
     1156. Comparison between the original image 2Mb and the optimized version 79kb. Image width px: 1200, JPG quality 70.
     1167. Comparison between the original image 7Mb and the optimized version 55kb. Image width px: 1200, JPG quality 70.
     1178. Comparison between the original image 1Mb and the optimized version 91kb. Image width px: 1200, JPG quality 70. 
    115118
    116119== Changelog ==
     120
     121= 1.8.2 =
     122* Fixed an issue where non-transparent images were incorrectly detected as transparent.
     123* Updated some Text in Option Page
     124
    117125
    118126= 1.8 =
  • raina-image-compression/trunk/raina-image-compression.php

    r3405323 r3410991  
    44* Description: Raina Image Compression automatically optimizes JPG, PNG, and WebP images on upload for faster, cleaner websites. It resizes, converts, and compresses images without losing quality — all handled locally, with no external services required.
    55* Plugin URI: https://www.reggae.it/my-wordpress-plugins
    6 * Version: 1.8
     6* Version: 1.8.2
    77* Requires at least: 5.6
    88* Requires PHP: 7.4
     
    593593    $h = imagesy($img);
    594594
    595 
    596 
    597     for ($x = 0; $x < $w; $x++) {
    598         for ($y = 0; $y < $h; $y++) {
    599             $rgba  = imagecolorat($img, $x, $y);
    600             $alpha = ($rgba & 0x7F000000) >> 24; // 0 = opaco, 127 = totalmente trasparente
     595    // Campionamento ogni 4 pixel per accelerare
     596    $step = 4;
     597
     598    for ($x = 0; $x < $w; $x += $step) {
     599        for ($y = 0; $y < $h; $y += $step) {
     600
     601            $rgba = imagecolorat($img, $x, $y);
     602            $alpha = ($rgba & 0x7F000000) >> 24;
     603
     604            // Pixel realmente trasparente?
    601605            if ($alpha > 0) {
    602                 return true; // Trova trasparenza
     606                return true;
    603607            }
    604608        }
    605609    }
    606     return false; // Nessuna trasparenza
    607 }
     610
     611    return false;
     612}
     613
    608614
    609615
  • raina-image-compression/trunk/readme.txt

    r3405323 r3410991  
    44Tags: image compression, image optimization, webp, jpg, png
    55Tested up to: 6.8
    6 Stable tag: 1.8
     6Stable tag: 1.8.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    1131134. Admin bar toggle for quick enable/disable.
    1141145. Outputfile Options
     1156. Comparison between the original image 2Mb and the optimized version 79kb. Image width px: 1200, JPG quality 70.
     1167. Comparison between the original image 7Mb and the optimized version 55kb. Image width px: 1200, JPG quality 70.
     1178. Comparison between the original image 1Mb and the optimized version 91kb. Image width px: 1200, JPG quality 70. 
    115118
    116119== Changelog ==
     120
     121= 1.8.2 =
     122* Fixed an issue where non-transparent images were incorrectly detected as transparent.
     123* Updated some Text in Option Page
     124
    117125
    118126= 1.8 =
Note: See TracChangeset for help on using the changeset viewer.