Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

rawbertp
Copy link
Contributor

@rawbertp rawbertp commented Nov 6, 2019

This is a follow-up to #172

@sualko

I think we can also skip the jpeg conversion, if no filters/borders and so on are applied. That would also enhance the performance.

#172 (comment)

Change:

When no filters selected the original image will be kept/used.

@sualko
Copy link
Collaborator

sualko commented Nov 21, 2019

I think this pr needs an update because the commit can't be found.

@rawbertp
Copy link
Contributor Author

Not sure what you mean? I can see 80a3daa even when not logged in...

@sualko
Copy link
Collaborator

sualko commented Nov 21, 2019

I probably followed a link in an email and while you force-pushed the referenced commit was not there. Sorry for the confusion.

Copy link
Collaborator

@sualko sualko left a 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);
Copy link
Collaborator

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);
Copy link
Collaborator

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));
Copy link
Collaborator

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.

@andi34 andi34 force-pushed the master branch 2 times, most recently from 847f587 to cf39905 Compare January 11, 2020 16:07
@andi34 andi34 mentioned this pull request Feb 24, 2020
@andi34
Copy link
Collaborator

andi34 commented Aug 6, 2020

#226 was merged.

When no filters selected the original image will be kept/used: e3678a7

@andi34 andi34 closed this Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants