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

fix: improve quality of image before sending to server #3680

Merged
merged 14 commits into from
Dec 24, 2019
Merged

fix: improve quality of image before sending to server #3680

merged 14 commits into from
Dec 24, 2019

Conversation

maze-runnar
Copy link
Contributor

Fixes #3663
it is resizing the image to higher pixel before sending to server
Screenshot from 2019-12-02 18-01-52

Checklist

  • I have read the Contribution & Best practices Guide.
  • My branch is up-to-date with the Upstream development branch.
  • The acceptance, integration, unit tests and linter pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@auto-label auto-label bot added the fix label Dec 2, 2019
@@ -32,7 +32,7 @@ export default ModalBase.extend({
this.onVisible();
},
cropImage() {
this.$('img').croppie('result', 'base64', 'original', 'jpeg').then(result => {
this.$('img').croppie('result', 'base64', 'original', 'jpeg', 1).then(result => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this one, any official guide?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quality parameter in croppie .

Link to official guide ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maze-runnar
Copy link
Contributor Author

Quality parameter in croppie .

@maze-runnar
Copy link
Contributor Author

@kushthedude i have migrated the cropper-madal code to ES6 , should i open a seperate PR for that ?

@kushthedude
Copy link
Member

kushthedude commented Dec 2, 2019 via email

@@ -94,7 +94,7 @@
icon='camera'
hint=(t 'Select Event Image')
maxSizeInKb=10000
helpText=(t 'We recommend using at least a 2160x1080px (2:1 ratio) image')
helpText=(t 'We recommend using at least a 2160x1080px (2:1 ratio) image and never less than 1500x750px image')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have already specified the at least, This change is unneeded.

@kushthedude
Copy link
Member

kushthedude commented Dec 5, 2019 via email

@maze-runnar
Copy link
Contributor Author

Default is already 1, Why define explicitly then?

On Thu, 5 Dec, 2019, 19:26 Sundaram Dubey, @.> wrote: @.* commented on this pull request. ------------------------------ In app/components/modals/cropper-modal.js <#3680 (comment)> : > @@ -32,7 +32,7 @@ export default ModalBase.extend({ this.onVisible(); }, cropImage() { - this.$('img').croppie('result', 'base64', 'original', 'jpeg').then(result => { + this.$('img').croppie('result', 'base64', 'original', 'jpeg', 1).then(result => { https://foliotek.github.io/Croppie/ — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#3680?email_source=notifications&email_token=AKQMTLSDVX2UEDUFUI2YYWTQXECCRA5CNFSM4JTVDHD2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCODEBJY#discussion_r354326063>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKQMTLUVH5SKHXF7U4H2BGDQXECCRANCNFSM4JTVDHDQ .

i got that it's affecting the quality a bit , if you say i will remove it .

Copy link
Member

@kushthedude kushthedude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also dont change the factor, Simply change the result method for the images used to this :

'viewport' the size of the resulting image will be the same width and height as the viewport
'original' the size of the resulting image will be at the original scale of the image

Just change the viewport to the original

@@ -32,7 +32,7 @@ export default ModalBase.extend({
this.onVisible();
},
cropImage() {
this.$('img').croppie('result', 'base64', 'original', 'jpeg').then(result => {
this.$('img').croppie('result', 'base64', 'original', 'jpeg', 1).then(result => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this change

@kushthedude
Copy link
Member

Also dont change the factor, Simply change the result method for the images used to this :

'viewport' the size of the resulting image will be the same width and height as the viewport
'original' the size of the resulting image will be at the original scale of the image

Just change the viewport to the original

.

@maze-runnar
Copy link
Contributor Author

maze-runnar commented Dec 6, 2019

Also dont change the factor, Simply change the result method for the images used to this :

'viewport' the size of the resulting image will be the same width and height as the viewport
'original' the size of the resulting image will be at the original scale of the image

Just change the viewport to the original

it''s not making any diffrence in quality and returning that poor quality again . when i am changing like this -
this.$('img').croppie('result', 'base64', 'original', 'jpeg')
Foliotek/Croppie#438

@kushthedude
Copy link
Member

Also dont change the factor, Simply change the result method for the images used to this :

'viewport' the size of the resulting image will be the same width and height as the viewport
'original' the size of the resulting image will be at the original scale of the image

Just change the viewport to the original

it''s not making any diffrence in quality and returning that poor quality again . when i am changing like this -
this.$('img').croppie('result', 'base64', 'original', 'jpeg')
Foliotek/Croppie#438

@maze-runnar I think you will need to upgrade our croppie version too. Also, The following solution should work.

@maze-runnar
Copy link
Contributor Author

@kushthedude should i update cropipie to 2.6.4 https://www.npmjs.com/package/croppie/v/2.6.4

@kushthedude
Copy link
Member

kushthedude commented Dec 14, 2019 via email

@maze-runnar
Copy link
Contributor Author

Screenshot from 2019-12-14 23-42-21
Screenshot from 2019-12-14 23-44-03
@kushthedude i have upgraded the croppie but still no difference

@kushthedude
Copy link
Member

kushthedude commented Dec 14, 2019 via email

@maze-runnar
Copy link
Contributor Author

working finally 😌
Screenshot from 2019-12-21 14-01-56

@maze-runnar
Copy link
Contributor Author

@kushthedude please review

kushthedude
kushthedude previously approved these changes Dec 21, 2019
@@ -32,7 +32,7 @@ export default ModalBase.extend({
this.onVisible();
},
cropImage() {
this.$('img').croppie('result', 'base64', 'original', 'jpeg').then(result => {
this.$('img').croppie('result', { type: 'base64', size: 'original', quality: 1 }).then(result => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maze-runnar Why did you remove the jpeg ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it's not needed.and it was working fine so i removed it .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please restore it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

package.json Outdated
@@ -136,7 +136,7 @@
},
"private": true,
"dependencies": {
"@bower_components/Croppie": "Foliotek/Croppie#^2.4.1",
"@bower_components/Croppie": "Foliotek/Croppie#^2.6.4",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maze-runnar You sure there will be no changes to yarn.lock for this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes , i don't made any changes beside this in my local . So i am sure .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert it, not needed

Copy link
Member

@kushthedude kushthedude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maze-runnar One last thing, Just to be on the safe side, Can you please upload a video or GIF showing the images are not scaling down then we can merge it.

@maze-runnar
Copy link
Contributor Author

Screenshot from 2019-12-24 13-02-21

@maze-runnar
Copy link
Contributor Author

@maze-runnar
Copy link
Contributor Author

maze-runnar commented Dec 24, 2019

https://youtu.be/xsjCQJfWyrM

@kushthedude please merge.

package.json Outdated Show resolved Hide resolved
Co-Authored-By: Kush Trivedi <[email protected]>
@iamareebjamal iamareebjamal merged commit 9bd3a2e into fossasia:development Dec 24, 2019
@iamareebjamal
Copy link
Member

@kushthedude Please prepare a release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cropper resizes images before sending to server
3 participants