Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

allow caching of remote image with query params intact

new arg support: cache_with_query_params
  • Loading branch information...
commit 65f3814716e86afc211b5d4703789bb01b1da02b 1 parent 370cf5b
tcrsavage authored
Showing with 19 additions and 15 deletions.
  1. +19 −15 wpthumb.php
View
34 wpthumb.php
@@ -152,21 +152,22 @@ public function setFilePath( $file_path ) {
public function setArgs( $args ) {
$arg_defaults = array(
- 'width' => 0,
- 'height' => 0,
- 'crop' => false,
- 'crop_from_position' => 'center,center',
- 'resize' => true,
- 'watermark_options' => array(),
- 'cache' => true,
- 'skip_remote_check' => false,
- 'default' => null,
- 'jpeg_quality' => 90,
- 'resize_animations' => true,
- 'return' => 'url',
- 'custom' => false,
- 'background_fill' => null,
- 'output_file' => false
+ 'width' => 0,
+ 'height' => 0,
+ 'crop' => false,
+ 'crop_from_position' => 'center,center',
+ 'resize' => true,
+ 'watermark_options' => array(),
+ 'cache' => true,
+ 'skip_remote_check' => false,
+ 'default' => null,
+ 'jpeg_quality' => 90,
+ 'resize_animations' => true,
+ 'return' => 'url',
+ 'custom' => false,
+ 'background_fill' => null,
+ 'output_file' => false,
+ 'cache_with_query_params' => false
);
$args = wp_parse_args( $args, $arg_defaults );
@@ -223,6 +224,9 @@ public function getFilePath() {
if ( strpos( $this->file_path, '/' ) === 0 && ! file_exists( $this->file_path ) && $this->args['default'] )
$this->file_path = $this->args['default'];
+ if ( $this->getArg( 'cache_with_query_params' ) )
+ return $this->file_path;
+
return reset( explode( '?', $this->file_path ) );
}
Please sign in to comment.
Something went wrong with that request. Please try again.