-
Notifications
You must be signed in to change notification settings - Fork 254
Update UploadBehavior.php #338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1344,7 +1344,7 @@ protected function _resizePhp(Model $model, $field, $path, $size, $geometry, $th | |
$outputHandler = 'imagepng'; | ||
$supportsQuality = true; | ||
// convert 0 (lowest) - 100 (highest) thumbnailQuality, to 0 (highest) - 9 (lowest) quality (see http://php.net/manual/en/function.imagepng.php) | ||
$adjustedQuality = intval((100 - $this->settings[$model->alias][$field]['thumbnailQuality']) / 100 * 9); | ||
$adjustedQuality = (int)((100 - $this->settings[$model->alias][$field]['thumbnailQuality']) / 100 * 9); | ||
break; | ||
default: | ||
return false; | ||
|
@@ -1508,12 +1508,12 @@ protected function _createImageResource($filename, $pathInfo) { | |
*/ | ||
protected function _imagecreatefromjpegexif($filename) { | ||
$image = imagecreatefromjpeg($filename); | ||
$exif = false; | ||
$exif = array(); | ||
if (function_exists('exif_read_data')) { | ||
$exif = exif_read_data($filename); | ||
} | ||
|
||
if ($image && $exif && isset($exif['Orientation'])) { | ||
if ($image && isset($exif['Orientation']) == true) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you revert this, I can merge. |
||
$ort = $exif['Orientation']; | ||
} else { | ||
return $image; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is OK for Merge, intval() old function PHP4 for format correct cast val in PHP 5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note: intval should work just fine in PHP 5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
If it works well intval() in PHP 5, but is not recommended to use more it is a function deprecator. Also in the same code is being used cast (int) and for better code quality must remain consistent.
Example:
UploadBehavior.php
Lines 508, 605.630, etc ...