Plugin Directory

Changeset 3749733


Ignore:
Timestamp:
10/16/2026 05:48:49 AM (5 weeks ago)
Author:
spinxdigitaldev
Message:

Change update

Location:
spinx-digital-image-converter
Files:
50 added
3 edited

Legend:

Unmodified
Added
Removed
  • spinx-digital-image-converter/trunk/app/Services/SDIC_MediaLibraryService.php

    r3575227 r3749733  
    5151            }
    5252
    53             $image      = wp_get_image_editor($actualWebpPath);
     53            // Header-only read: an image editor would decode the whole file just for its size.
     54            $imageSize  = wp_getimagesize($actualWebpPath);
    5455            $dimensions = [];
    5556
    56             if (!is_wp_error($image)) {
    57                 $size       = $image->get_size();
     57            if ($imageSize) {
    5858                $dimensions = [
    59                     'width'  => $size['width'] ?? 0,
    60                     'height' => $size['height'] ?? 0,
     59                    'width'  => $imageSize[0] ?? 0,
     60                    'height' => $imageSize[1] ?? 0,
    6161                ];
    6262            }
    … …  
    111111
    112112        // Try stored path first.
    113         if (file_exists($webpPath)) {
     113        if ($this->isLocalFile($webpPath)) {
    114114            return $webpPath;
    115115        }
    … …  
    118118        if ($webpUrl) {
    119119            $filePath = $this->urlToPath($webpUrl);
    120             if ($filePath && file_exists($filePath)) {
     120            if ($filePath && $this->isLocalFile($filePath)) {
    121121                return $filePath;
    122122            }
    123123        }
    124124
    125         // Try to construct path from original file directory.
     125        // Try to construct path from original file directory. Offload plugins return a
     126        // stream-wrapper path (e.g. s3://) here once the local file is gone.
    126127        $originalFile = get_attached_file($attachmentId);
    127128        if ($originalFile) {
    … …  
    130131            $constructedPath = $dir . '/' . $webpFileName;
    131132
    132             if (file_exists($constructedPath)) {
     133            if ($this->isLocalFile($constructedPath)) {
    133134                return $constructedPath;
    134135            }
    … …  
    142143            // Try in uploads root.
    143144            $tryPath = $uploadsDir['basedir'] . '/' . $fileName;
    144             if (file_exists($tryPath)) {
     145            if ($this->isLocalFile($tryPath)) {
    145146                return $tryPath;
    146147            }
    … …  
    150151                if (preg_match('/uploads\/(\d{4})\/(\d{2})\/(.+?)$/', $webpUrl, $matches)) {
    151152                    $tryPath = $uploadsDir['basedir'] . '/' . $matches[1] . '/' . $matches[2] . '/' . $matches[3];
    152                     if (file_exists($tryPath)) {
     153                    if ($this->isLocalFile($tryPath)) {
    153154                        return $tryPath;
    154155                    }
    … …  
    158159
    159160        return null;
     161    }
     162
     163    /**
     164     * Whether $path is a file on local disk. Stream-wrapper paths (s3://, gs://, ...) from
     165     * offload plugins are rejected without touching them: every stat on one is a network
     166     * request, which made the Media Library take seconds per attachment.
     167     */
     168    private function isLocalFile(string $path): bool
     169    {
     170        return $path !== '' && !wp_is_stream($path) && file_exists($path);
    160171    }
    161172
    … …  
    203214        // original_size is stale. Fall back to the live local file, then the stored size.
    204215        $fileSize = ! empty($meta['filesize']) ? (int) $meta['filesize'] : 0;
    205         if ($fileSize <= 0 && $file && file_exists($file)) {
     216        if ($fileSize <= 0 && $file && $this->isLocalFile($file)) {
    206217            $fileSize = (int) filesize($file);
    207218        }
  • spinx-digital-image-converter/trunk/readme.txt

    r3732655 r3749733  
    55Tested up to: 7.1
    66Requires PHP: 8.0
    7 Stable tag: 1.0.3
     7Stable tag: 1.0.4
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    170170
    171171== Changelog ==
     172
     173= 1.0.4 =
     174* Improved: Media Library screens load much faster on sites that offload media to cloud storage (Amazon S3, Google Cloud Storage, and similar). The plugin no longer checks remote storage paths when looking for local WebP files, which previously added a network request for every image shown.
     175* Improved: WebP image dimensions are now read from the file header instead of loading the whole image into memory, lowering memory use when displaying WebP details.
     176* Tested with WordPress 7.1.
    172177
    173178= 1.0.3 =
    … …  
    215220== Upgrade Notice ==
    216221
     222= 1.0.4 =
     223Faster Media Library screens on sites that offload media to cloud storage, and lower memory use when reading WebP details. Tested with WordPress 7.1.
     224
    217225= 1.0.3 =
    218226Adds an optional server-level (.htaccess) WebP delivery mode with automatic browser fallback that also covers page-builder and CSS images. Default behavior is unchanged.
  • spinx-digital-image-converter/trunk/spinx-digital-image-converter.php

    r3706677 r3749733  
    44 * Plugin URI:        https://wordpress.org/plugins/spinx-digital-image-converter/
    55 * Description:       Convert JPEG, PNG, and GIF image to WebP, bulk convert to your Media Library images to webp.
    6  * Version:           1.0.3
     6 * Version:           1.0.4
    77 * Author:            SPINX Digital
    88 * Author URI:        https://www.spinxdigital.com/
    … …  
    4343
    4444if ( ! defined( 'SDIC_PLUGIN_VERSION' ) ) {
    45         define( 'SDIC_PLUGIN_VERSION', '1.0.3' );
     45        define( 'SDIC_PLUGIN_VERSION', '1.0.4' );
    4646}
    4747
Note: See TracChangeset for help on using the changeset viewer.