-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Added new method to resize images #63
Conversation
Thanks a mil for raising this PR and wanting to improve this project. It looks good to me and can merge it once we have some more 👍 from other users. I hope that's okay? |
My pleasure!, and yeah that's totally fine by me :) |
Hi Ram. It's been 5 months, and I wanted to check-in on this. I'm still okay for this to be merged if you're happy with it? If you've decided not to progress with this approach: please let me know and I'll close out this PR Kind Regards |
Hi @Hoppi164 , Apologies for not responding earlier. I can merge it now if you're still interested? Also, did you try setting it as a |
That's great @Hoppi164 so can we please get rid of the unused dependency block in Update: I modified it. |
// Helper function to resize images using sharp | ||
async function resize(fileName, size) { | ||
let sizeMap = { | ||
'full' : {width: 1024, height:768, location:'./images/fulls'}, |
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.
Would it be possible to specify a height here and just the width? This will maintain the aspect ratio of the images I think?
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 there,
Do you mean specifying JUST the height?
Like below?
let sizeMap = {
'full' : { height:768, location:'./images/fulls'},
'thumb' : { height:256, location:'./images/thumbs'}
}
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 feel it might be better to maintain the aspect ratio based on the width instead.
I think that's what you're doing in the previous gulpfile too.
Are you happy with the below width approach?
let sizeMap = {
'full' : { width:1024, location:'./images/fulls'},
'thumb' : { width:512, location:'./images/thumbs'}
}
Hi Ram, Oh i see what you mean with the package.json empty dependancy |
Hi there
There is an issue when trying to resize images using
gulp
I encountered the same error that is listed in this issue #37
This seems to be an internal issue with gulp which completely stops the 'resizing' functionality from working.
I've designed an alternate method to efficiently resize the images into "full" and "thumb" folders.
you can execute this script by running
npm run resize