diff --git a/includes/imagecrop.admin.inc b/includes/imagecrop.admin.inc index 70eaaec..2695f8a 100644 --- a/includes/imagecrop.admin.inc +++ b/includes/imagecrop.admin.inc @@ -169,7 +169,7 @@ function imagecrop_image_styles_overview($fid, $style_name, $entity_type = NULL, $image_url = image_style_url($style_name, $imagecrop->getFile()->uri); $clean_url = variable_get('clean_url', 0); - $image_url .= ($clean_url || !strpos($image_url, '?') ? '?' : '&'); + $image_url .= !strstr($image_url, '?') ? '?' : '&'; $image_url .= 'time=' . $_SERVER['REQUEST_TIME']; return theme('imagecrop_overview', array( @@ -557,4 +557,4 @@ function imagecrop_get_enabled_styles_for_crop($entity_type, $bundle, $field_nam return $styles; -} \ No newline at end of file +} diff --git a/includes/imagecrop.class.inc b/includes/imagecrop.class.inc index 73af13c..de31525 100644 --- a/includes/imagecrop.class.inc +++ b/includes/imagecrop.class.inc @@ -339,7 +339,8 @@ class ImageCrop { public function getCropDestination($filepath = TRUE, $add_timestamp = TRUE) { $image_url = ($filepath) ? file_create_url($this->cropDestination) : $this->cropDestination; if ($add_timestamp) { - $image_url .= '?time=' . $_SERVER['REQUEST_TIME']; + $image_url .= (strpos($image_url, '?') !== FALSE ? '&' : '?'); + $image_url .= 'time=' . $_SERVER['REQUEST_TIME']; } return $image_url; } diff --git a/js/imagecrop.js b/js/imagecrop.js index 2f9c97a..771058d 100644 --- a/js/imagecrop.js +++ b/js/imagecrop.js @@ -28,7 +28,8 @@ Drupal.Imagecrop.changeViewedImage = function(style_name) { */ Drupal.Imagecrop.refreshImage = function() { var source = $(this).attr('src'); - $(this).attr('src', (source + '?time=' + new Date().getTime())); + var delimiter = source.indexOf('?') === -1 ? '?' : '&'; + $(this).attr('src', (source + delimiter + 'time=' + new Date().getTime())); } })(jQuery); \ No newline at end of file diff --git a/js/imagecrop.ui.crop.js b/js/imagecrop.ui.crop.js index 5646994..acfd966 100644 --- a/js/imagecrop.ui.crop.js +++ b/js/imagecrop.ui.crop.js @@ -172,9 +172,10 @@ Drupal.Imagecrop.cropUi.applyEffects = function() { } // force new backgrounds and width / height - var background = Drupal.Imagecrop.cropFile + '?time=' + new Date().getTime(); + var delimiter = Drupal.Imagecrop.cropFile.indexOf('?') === -1 ? '?' : '&'; + var background = Drupal.Imagecrop.cropFile + delimiter +'time=' + new Date().getTime(); Drupal.Imagecrop.jcrop.setImage(background, function() { - var coordinates = Drupal.Imagecrop.cropUi.getCoordinates(); + var coordinates = Drupal.Imagecrop.cropUi.getCoordinates(); this.animateTo(coordinates); });