1
1
<?php
2
2
/*
3
- * jQuery File Upload Plugin PHP Class 6.6.1
3
+ * jQuery File Upload Plugin PHP Class 6.6.2
4
4
* https://github.com/blueimp/jQuery-File-Upload
5
5
*
6
6
* Copyright 2010, Sebastian Tschan
@@ -353,9 +353,10 @@ protected function create_scaled_image($file_name, $version, $options) {
353
353
$ options ['png_quality ' ] : 9 ;
354
354
break ;
355
355
default :
356
- $ src_img = null ;
356
+ imagedestroy ($ new_img );
357
+ return false ;
357
358
}
358
- $ success = $ src_img && imagecopyresampled (
359
+ $ success = imagecopyresampled (
359
360
$ new_img ,
360
361
$ src_img ,
361
362
$ dst_x ,
@@ -368,9 +369,7 @@ protected function create_scaled_image($file_name, $version, $options) {
368
369
$ img_height
369
370
) && $ write_image ($ new_img , $ new_file_path , $ image_quality );
370
371
// Free up memory (imagedestroy does not delete files):
371
- if ($ src_img ) {
372
- imagedestroy ($ src_img );
373
- }
372
+ imagedestroy ($ src_img );
374
373
imagedestroy ($ new_img );
375
374
return $ success ;
376
375
}
@@ -692,7 +691,8 @@ protected function handle_file_upload($uploaded_file, $name, $size, $type, $erro
692
691
if ($ file_size === $ file ->size ) {
693
692
$ file ->url = $ this ->get_download_url ($ file ->name );
694
693
list ($ img_width , $ img_height ) = @getimagesize ($ file_path );
695
- if (is_int ($ img_width )) {
694
+ if (is_int ($ img_width ) &&
695
+ preg_match ($ this ->options ['inline_file_types ' ], $ file ->name )) {
696
696
$ this ->handle_image_file ($ file_path , $ file );
697
697
}
698
698
} else {
0 commit comments