summaryrefslogtreecommitdiff
path: root/includes/file.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/file.inc')
-rw-r--r--includes/file.inc10
1 files changed, 4 insertions, 6 deletions
diff --git a/includes/file.inc b/includes/file.inc
index aa3b7f190..477f06b5a 100644
--- a/includes/file.inc
+++ b/includes/file.inc
@@ -1183,13 +1183,11 @@ function file_validate_image_resolution($file, $maximum_dimensions = 0, $minimum
list($width, $height) = explode('x', $maximum_dimensions);
if ($info['width'] > $width || $info['height'] > $height) {
// Try to resize the image to fit the dimensions.
- if (image_get_toolkit() && image_scale($file->filepath, $file->filepath, $width, $height)) {
+ if ($image = image_load($file->filepath)) {
+ image_scale($image, $width, $height);
+ image_save($image);
+ $file->filesize = $image->info['file_size'];
drupal_set_message(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', array('%dimensions' => $maximum_dimensions)));
-
- // Clear the cached filesize and refresh the image information.
- clearstatcache();
- $info = image_get_info($file->filepath);
- $file->filesize = $info['file_size'];
}
else {
$errors[] = t('The image is too large; the maximum dimensions are %dimensions pixels.', array('%dimensions' => $maximum_dimensions));