Skip to content

Commit

Permalink
* Fix for incorrect imgix URL generation
Browse files Browse the repository at this point in the history
  • Loading branch information
jawngee committed Feb 10, 2021
1 parent fa39642 commit 5479ffd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
10 changes: 10 additions & 0 deletions classes/Tools/Debugging/System/SystemCompatibilityTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 <a href='$url'>sample file</a> is not publicly viewable.";
}

$imgixURL = $imgixTool->urlForKey('_troubleshooter/sample.jpg');

$faster = new FasterImage();
Expand Down
4 changes: 2 additions & 2 deletions classes/Tools/Imgix/ImgixTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -1007,15 +1007,15 @@ 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);
if(!empty($key)) {
$imgix->setSignKey($key);
}

return $imgix->createURL($key, []);
return $imgix->createURL($imageKey, []);
}

//endregion
Expand Down
4 changes: 2 additions & 2 deletions ilab-media-tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5479ffd

Please sign in to comment.