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

feat: add nativeImage.createThumbnailFromPath API #24802

Merged
merged 25 commits into from Aug 24, 2020

Conversation

georgexu99
Copy link
Contributor

@georgexu99 georgexu99 commented Jul 31, 2020

Description of Change

This api returns a preview thumbnail of a file given its file path. The thumbnail is the same as a file's preview picture in explorer/finder.

Checklist

Release Notes

Notes: Added app.createThumbnailFromPath() API that returns a preview image of a file given its file path and a maximum thumbnail size.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jul 31, 2020
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Aug 1, 2020
@georgexu99 georgexu99 changed the title [WIP] feat: add app.createThumbnailFromPath API feat: add app.createThumbnailFromPath API Aug 6, 2020
@georgexu99 georgexu99 marked this pull request as ready for review August 7, 2020 18:03
Copy link
Member

@zcbenz zcbenz left a comment

Choose a reason for hiding this comment

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

This API does not belong to app module, I believe it should be part of shell or nativeImage module (I prefer shell a bit).

/cc @electron/wg-api for more inputs.

@MarshallOfSound
Copy link
Member

I think it fits with nativeImage nicely (create from x). I think it was originally put in app because of app.getFileIcon which is kinda weird to be in app as well 🤷

shell/common/api/electron_api_native_image_mac.mm Outdated Show resolved Hide resolved
shell/common/api/electron_api_native_image_mac.mm Outdated Show resolved Hide resolved
shell/common/api/electron_api_native_image_mac.mm Outdated Show resolved Hide resolved
shell/common/api/electron_api_native_image_mac.mm Outdated Show resolved Hide resolved
shell/common/api/electron_api_native_image_mac.mm Outdated Show resolved Hide resolved
shell/common/api/electron_api_native_image_win.cc Outdated Show resolved Hide resolved
shell/common/api/electron_api_native_image_win.cc Outdated Show resolved Hide resolved
shell/common/api/electron_api_native_image_win.cc Outdated Show resolved Hide resolved
shell/common/api/electron_api_native_image_mac.mm Outdated Show resolved Hide resolved
shell/common/api/electron_api_native_image_win.cc Outdated Show resolved Hide resolved
@MarshallOfSound MarshallOfSound changed the title feat: add app.createThumbnailFromPath API feat: add nativeImage.createThumbnailFromPath API Aug 18, 2020
@trop
Copy link
Contributor

trop bot commented Aug 20, 2020

@georgexu99 has manually backported this PR to "10-x-y", please check out #25072

@jkleinsc
Copy link
Contributor

The @electron/wg-api approved this via Slack on Aug 20th, 2020

@MarshallOfSound MarshallOfSound merged commit beaf60d into electron:master Aug 24, 2020
@release-clerk
Copy link

release-clerk bot commented Aug 24, 2020

Release Notes Persisted

Added app.createThumbnailFromPath() API that returns a preview image of a file given its file path and a maximum thumbnail size.

@gaodeng
Copy link

gaodeng commented Nov 21, 2020

I tried to get app icon and got an error

Error: unable to retrieve thumbnail preview image for the given path

Does this API only get thumbnails of images?
In that case, there doesn't seem to be much difference between this api and nativeImage.createFromPath(path) + resize

@MentalGear
Copy link

MentalGear commented Jun 29, 2022

@gaodeng I'm also trying to get app icons in a cross-platform, high-res way. Could you share whether nativeImage.createThumbnailFromPath worked out for you, or what your best approach was?

@fanchenio
Copy link

@MentalGear Facts have proved that high-definition icons can only be obtained through native mode, and electron does not support it.

@georgexu99 georgexu99 deleted the anewbranch branch November 21, 2022 19:54
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.

None yet

10 participants