-
Notifications
You must be signed in to change notification settings - Fork 162
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
[WIP] Do not alter pictures unless filters applied #186
Conversation
a85af6d
to
80a3daa
Compare
I think this pr needs an update because the commit can't be found. |
Not sure what you mean? I can see 80a3daa even when not logged in... |
I probably followed a link in an email and while you force-pushed the referenced commit was not there. Sorry for the confusion. |
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.
I think this pr is good in general, but the code quality could be enhanced.
// image scale, create thumbnail | ||
$thumbResource = resizeImage($imageResource, 500, 500); | ||
$thumbResource = resizeImage(createImageResource($imageResource, $filename_tmp), 500, 500); |
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.
We are always creating a thumbnail and therefore we always have to create a image resource.
|
||
imagejpeg($thumbResource, $filename_thumb, $config['jpeg_quality_thumb']); | ||
imagedestroy($thumbResource); | ||
|
||
imagejpeg($imageResource, $filename_photo, $config['jpeg_quality_image']); | ||
imagedestroy($imageResource); | ||
if (!empty($imageResource)) imagedestroy($imageResource); |
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.
At this point $imageResource
is always not empty.
$image_filter = $_POST['filter']; | ||
} | ||
|
||
// apply filter | ||
if ($image_filter) { | ||
applyFilter($image_filter, $imageResource); | ||
applyFilter($image_filter, createImageResource($imageResource, $filename_tmp)); |
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.
For me this makes the code less readable.
847f587
to
cf39905
Compare
This is a follow-up to #172
@sualko
#172 (comment)
Change:
When no filters selected the original image will be kept/used.