Changeset 3749733
- Timestamp:
- 10/16/2026 05:48:49 AM (5 weeks ago)
- Location:
- spinx-digital-image-converter
- Files:
-
- 50 added
- 3 edited
-
tags/1.0.4 (added)
-
tags/1.0.4/admin (added)
-
tags/1.0.4/admin/assets (added)
-
tags/1.0.4/admin/assets/admin-app.js (added)
-
tags/1.0.4/admin/assets/admin.css (added)
-
tags/1.0.4/admin/assets/media-restore.js (added)
-
tags/1.0.4/app (added)
-
tags/1.0.4/app/Batches (added)
-
tags/1.0.4/app/Batches/SDIC_Batch.php (added)
-
tags/1.0.4/app/Batches/SDIC_BatchItem.php (added)
-
tags/1.0.4/app/Batches/SDIC_BatchRegistry.php (added)
-
tags/1.0.4/app/Batches/SDIC_BulkConvertBatch.php (added)
-
tags/1.0.4/app/Controllers (added)
-
tags/1.0.4/app/Controllers/SDIC_AdminController.php (added)
-
tags/1.0.4/app/Controllers/SDIC_ApiController.php (added)
-
tags/1.0.4/app/Controllers/SDIC_CliController.php (added)
-
tags/1.0.4/app/Controllers/SDIC_CronController.php (added)
-
tags/1.0.4/app/Controllers/SDIC_MediaController.php (added)
-
tags/1.0.4/app/Core (added)
-
tags/1.0.4/app/Core/SDIC_Activator.php (added)
-
tags/1.0.4/app/Core/SDIC_Deactivator.php (added)
-
tags/1.0.4/app/Core/SDIC_Plugin.php (added)
-
tags/1.0.4/app/Helpers (added)
-
tags/1.0.4/app/Helpers/SDIC_Settings.php (added)
-
tags/1.0.4/app/Services (added)
-
tags/1.0.4/app/Services/SDIC_BulkJobStatusService.php (added)
-
tags/1.0.4/app/Services/SDIC_HtaccessDeliveryService.php (added)
-
tags/1.0.4/app/Services/SDIC_ImageConverterService.php (added)
-
tags/1.0.4/app/Services/SDIC_LoggerService.php (added)
-
tags/1.0.4/app/Services/SDIC_MediaLibraryService.php (added)
-
tags/1.0.4/app/Services/SDIC_OffloadResolver.php (added)
-
tags/1.0.4/app/Services/SDIC_QueueService.php (added)
-
tags/1.0.4/app/Services/SDIC_StatsService.php (added)
-
tags/1.0.4/app/Support (added)
-
tags/1.0.4/app/Support/SDIC_Compat.php (added)
-
tags/1.0.4/assets (added)
-
tags/1.0.4/assets/screenshot-1.webp (added)
-
tags/1.0.4/assets/screenshot-2.webp (added)
-
tags/1.0.4/assets/screenshot-3.png (added)
-
tags/1.0.4/assets/screenshot-4.webp (added)
-
tags/1.0.4/assets/screenshot-5.webp (added)
-
tags/1.0.4/images (added)
-
tags/1.0.4/images/logo-favicon.svg (added)
-
tags/1.0.4/includes (added)
-
tags/1.0.4/includes/autoload.php (added)
-
tags/1.0.4/languages (added)
-
tags/1.0.4/languages/spinx-digital-image-converter.pot (added)
-
tags/1.0.4/readme.txt (added)
-
tags/1.0.4/spinx-digital-image-converter.php (added)
-
tags/1.0.4/uninstall.php (added)
-
trunk/app/Services/SDIC_MediaLibraryService.php (modified) (8 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/spinx-digital-image-converter.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
spinx-digital-image-converter/trunk/app/Services/SDIC_MediaLibraryService.php
r3575227 r3749733 51 51 } 52 52 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); 54 55 $dimensions = []; 55 56 56 if (!is_wp_error($image)) { 57 $size = $image->get_size(); 57 if ($imageSize) { 58 58 $dimensions = [ 59 'width' => $ size['width'] ?? 0,60 'height' => $ size['height'] ?? 0,59 'width' => $imageSize[0] ?? 0, 60 'height' => $imageSize[1] ?? 0, 61 61 ]; 62 62 } … … 111 111 112 112 // Try stored path first. 113 if ( file_exists($webpPath)) {113 if ($this->isLocalFile($webpPath)) { 114 114 return $webpPath; 115 115 } … … 118 118 if ($webpUrl) { 119 119 $filePath = $this->urlToPath($webpUrl); 120 if ($filePath && file_exists($filePath)) {120 if ($filePath && $this->isLocalFile($filePath)) { 121 121 return $filePath; 122 122 } 123 123 } 124 124 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. 126 127 $originalFile = get_attached_file($attachmentId); 127 128 if ($originalFile) { … … 130 131 $constructedPath = $dir . '/' . $webpFileName; 131 132 132 if ( file_exists($constructedPath)) {133 if ($this->isLocalFile($constructedPath)) { 133 134 return $constructedPath; 134 135 } … … 142 143 // Try in uploads root. 143 144 $tryPath = $uploadsDir['basedir'] . '/' . $fileName; 144 if ( file_exists($tryPath)) {145 if ($this->isLocalFile($tryPath)) { 145 146 return $tryPath; 146 147 } … … 150 151 if (preg_match('/uploads\/(\d{4})\/(\d{2})\/(.+?)$/', $webpUrl, $matches)) { 151 152 $tryPath = $uploadsDir['basedir'] . '/' . $matches[1] . '/' . $matches[2] . '/' . $matches[3]; 152 if ( file_exists($tryPath)) {153 if ($this->isLocalFile($tryPath)) { 153 154 return $tryPath; 154 155 } … … 158 159 159 160 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); 160 171 } 161 172 … … 203 214 // original_size is stale. Fall back to the live local file, then the stored size. 204 215 $fileSize = ! empty($meta['filesize']) ? (int) $meta['filesize'] : 0; 205 if ($fileSize <= 0 && $file && file_exists($file)) {216 if ($fileSize <= 0 && $file && $this->isLocalFile($file)) { 206 217 $fileSize = (int) filesize($file); 207 218 } -
spinx-digital-image-converter/trunk/readme.txt
r3732655 r3749733 5 5 Tested up to: 7.1 6 6 Requires PHP: 8.0 7 Stable tag: 1.0. 37 Stable tag: 1.0.4 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 170 170 171 171 == 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. 172 177 173 178 = 1.0.3 = … … 215 220 == Upgrade Notice == 216 221 222 = 1.0.4 = 223 Faster 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 217 225 = 1.0.3 = 218 226 Adds 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 4 4 * Plugin URI: https://wordpress.org/plugins/spinx-digital-image-converter/ 5 5 * Description: Convert JPEG, PNG, and GIF image to WebP, bulk convert to your Media Library images to webp. 6 * Version: 1.0. 36 * Version: 1.0.4 7 7 * Author: SPINX Digital 8 8 * Author URI: https://www.spinxdigital.com/ … … 43 43 44 44 if ( ! defined( 'SDIC_PLUGIN_VERSION' ) ) { 45 define( 'SDIC_PLUGIN_VERSION', '1.0. 3' );45 define( 'SDIC_PLUGIN_VERSION', '1.0.4' ); 46 46 } 47 47
Note:
See TracChangeset
for help on using the changeset viewer.