From 5479ffd7722b051caa68489ccd95c05295546bdc Mon Sep 17 00:00:00 2001 From: Jon Gilkison Date: Wed, 10 Feb 2021 10:28:53 +0700 Subject: [PATCH] * Fix for incorrect imgix URL generation --- .../Tools/Debugging/System/SystemCompatibilityTool.php | 10 ++++++++++ classes/Tools/Imgix/ImgixTool.php | 4 ++-- ilab-media-tools.php | 4 ++-- readme.txt | 5 +++-- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/classes/Tools/Debugging/System/SystemCompatibilityTool.php b/classes/Tools/Debugging/System/SystemCompatibilityTool.php index b39382ff..4d210e76 100755 --- a/classes/Tools/Debugging/System/SystemCompatibilityTool.php +++ b/classes/Tools/Debugging/System/SystemCompatibilityTool.php @@ -20,6 +20,7 @@ use MediaCloud\Plugin\Tools\Tool; use MediaCloud\Plugin\Tools\ToolsManager; use MediaCloud\Plugin\Utilities\Logging\ErrorCollector; +use MediaCloud\Plugin\Utilities\Logging\Logger; use MediaCloud\Plugin\Utilities\Tracker; use MediaCloud\Plugin\Utilities\View; use MediaCloud\Vendor\Carbon\CarbonInterval; @@ -537,7 +538,16 @@ private function testImgix() { $errors = []; try { + Logger::info("Imgix test- uploading sample image with privacy:".StorageToolSettings::privacy(), [], __METHOD__, __LINE__); $storageTool->client()->upload('_troubleshooter/sample.jpg',ILAB_TOOLS_DIR.'/public/img/test-image.jpg', StorageToolSettings::privacy()); + + $url = $storageTool->client()->url('_troubleshooter/sample.jpg'); + $result = ilab_file_get_contents($url); + + if ($result != file_get_contents(ILAB_TOOLS_DIR.'/public/img/test-image.jpg')) { + $errors[] = "Uploaded sample file is not publicly viewable."; + } + $imgixURL = $imgixTool->urlForKey('_troubleshooter/sample.jpg'); $faster = new FasterImage(); diff --git a/classes/Tools/Imgix/ImgixTool.php b/classes/Tools/Imgix/ImgixTool.php index 11831ffe..e50dc7e3 100755 --- a/classes/Tools/Imgix/ImgixTool.php +++ b/classes/Tools/Imgix/ImgixTool.php @@ -1007,7 +1007,7 @@ public function mediaSendToEditor($html, $id, $attachment) { //region Testing - public function urlForKey($key) { + public function urlForKey($imageKey) { $domain = apply_filters('media-cloud/dynamic-images/override-domain', !empty($this->settings->imgixDomains) ? $this->settings->imgixDomains[0] : null); $imgix = new UrlBuilder($domain, $this->settings->useHTTPS); $key = apply_filters('media-cloud/dynamic-images/override-key', $this->settings->signingKey); @@ -1015,7 +1015,7 @@ public function urlForKey($key) { $imgix->setSignKey($key); } - return $imgix->createURL($key, []); + return $imgix->createURL($imageKey, []); } //endregion diff --git a/ilab-media-tools.php b/ilab-media-tools.php index d0311079..d01437e3 100755 --- a/ilab-media-tools.php +++ b/ilab-media-tools.php @@ -5,7 +5,7 @@ Plugin URI: https://github.com/interfacelab/ilab-media-tools Description: Automatically upload media to Amazon S3 and integrate with Imgix, a real-time image processing CDN. Boosts site performance and simplifies workflows. Author: interfacelab -Version: 4.2.0 +Version: 4.2.1 Author URI: http://interfacelab.io */ // Copyright (c) 2016 Interfacelab LLC. All rights reserved. @@ -94,7 +94,7 @@ } // Version Defines -define( 'MEDIA_CLOUD_VERSION', '4.2.0' ); +define( 'MEDIA_CLOUD_VERSION', '4.2.1' ); define( 'MEDIA_CLOUD_INFO_VERSION', '4.0.2' ); define( 'MCLOUD_IS_BETA', false ); // Directory defines diff --git a/readme.txt b/readme.txt index fec1cbd8..446c8dfa 100755 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Requires at least: 4.9 Tested up to: 5.6.1 License: GPLv3 or later License URI: http://www.gnu.org/licenses/gpl-3.0.html -Stable tag: 4.2.0 +Stable tag: 4.2.1 Requires PHP: 7.1 Automatically store media on Amazon S3, Google Cloud Storage, DigitalOcean Spaces + others. Serve CSS/JS assets through CDNs. Integrate with Imgix. @@ -105,8 +105,9 @@ Imgix is a content delivery network with a twist. In addition to distributing y == Changelog == -= 4.2.0 = += 4.2.1 = +* Fix for incorrect imgix URL generation * Massive overhaul of Elementor integration. Media Cloud now will support any Elementor addon and running the **Elementor Update Task** is super safe. Instead of the brute force text search/replace we were doing before, we are now analyzing every installed Elementor widget's properties for images to update and then walking your Elementor post