diff --git a/inc/functions.php b/inc/functions.php
index 9fb4e79..815c049 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -188,7 +188,7 @@ function wpsp_post_image( $settings ) {
}
if ( ! empty( $image_atts ) ) : ?>
-
+
'image' ) );
endif;
diff --git a/inc/image-resizer.php b/inc/image-resizer.php
index e62c16c..048f503 100644
--- a/inc/image-resizer.php
+++ b/inc/image-resizer.php
@@ -20,7 +20,7 @@
*
* @return str|array
*/
-
+
// No direct access, please
if ( ! defined( 'ABSPATH' ) ) exit;
@@ -81,23 +81,23 @@ public function process( $url, $width = null, $height = null, $crop = null, $sin
$upload_info = wp_upload_dir();
$upload_dir = $upload_info['basedir'];
$upload_url = $upload_info['baseurl'];
-
+
$http_prefix = "http://";
$https_prefix = "https://";
$relative_prefix = "//"; // The protocol-relative URL
-
- /* if the $url scheme differs from $upload_url scheme, make them match
+
+ /* if the $url scheme differs from $upload_url scheme, make them match
if the schemes differe, images don't show up. */
if(!strncmp($url,$https_prefix,strlen($https_prefix))){ //if url begins with https:// make $upload_url begin with https:// as well
$upload_url = str_replace($http_prefix,$https_prefix,$upload_url);
}
elseif(!strncmp($url,$http_prefix,strlen($http_prefix))){ //if url begins with http:// make $upload_url begin with http:// as well
- $upload_url = str_replace($https_prefix,$http_prefix,$upload_url);
+ $upload_url = str_replace($https_prefix,$http_prefix,$upload_url);
}
elseif(!strncmp($url,$relative_prefix,strlen($relative_prefix))){ //if url begins with // make $upload_url begin with // as well
$upload_url = str_replace(array( 0 => "$http_prefix", 1 => "$https_prefix"),$relative_prefix,$upload_url);
}
-
+
// Check if $img_url is local.
if ( false === strpos( $url, $upload_url ) )
@@ -142,11 +142,11 @@ public function process( $url, $width = null, $height = null, $crop = null, $sin
}
// Else, we resize the image and return the new resized image url.
else {
-
+
$editor = wp_get_image_editor( $img_path );
if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) ) {
- throw new WPSP_Exception('Unable to get WP_Image_Editor: ' .
+ throw new WPSP_Exception('Unable to get WP_Image_Editor: ' .
$editor->get_error_message() . ' (is GD or ImageMagick installed?)');
}
@@ -177,7 +177,7 @@ public function process( $url, $width = null, $height = null, $crop = null, $sin
2 => $dst_h
);
}
-
+
return $image;
}
catch (WPSP_Exception $ex) {
@@ -188,12 +188,12 @@ public function process( $url, $width = null, $height = null, $crop = null, $sin
throw $ex;
}
else {
- // Return false, so that this patch is backwards-compatible.
- return false;
+ // return input url in case of failure
+ return $url;
}
}
}
-
+
/**
* Callback to overwrite WP computing of thumbnail measures
*/
@@ -241,4 +241,4 @@ function WPSP_Resize( $url, $width = null, $height = null, $crop = null, $single
$WPSP_Resize = WPSP_Resize::getInstance();
return $WPSP_Resize->process( $url, $width, $height, $crop, $single, $upscale );
}
-endif;
\ No newline at end of file
+endif;