-
Notifications
You must be signed in to change notification settings - Fork 456
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
Thumbnail previews for Vivaldi html images #1591
Comments
This is not a bug. CopyQ won't fetch any remote content unless you specify such action with a custom command. So if the web browser does not provide an image format, you won't see the image in CopyQ. I'm against adding such feature due to security and performance concerns, and TBH I don't need such behavior because most of I use copy images to clipboard properly. |
@hluk Ok!
By this comment, I'm guessing that you won't add this feature. Can you show an example to set a custom command? I do need this feature. No matter which browser I use, It shows only the metadata. |
Check what formats the clipboard provides after copying an image (with Ctrl+Shift+C in the main window in CopyQ) and then create a new automated command in CopyQ to download image data. Example (untested): copyq:
// Change the input format (from clipboard)
var imageUrl = str(data('text/plain'))
if (!imageUrl.startsWith('https://') || !imageUrl.includes('.png'))
abort()
var reply = networkGet(imageUrl)
var imageData = str(reply.data)
if (reply.status != 200) {
throw 'Failed to fetch image data.'
+ '\nStatus code: ' + reply.status
+ '\nError: ' + reply.error
}
// Change the output format
copy('image/png', imageData) BTW, Firefox provides copied images properly in the clipboard. |
@hluk said:
I totally agree that CopyQ shouldn't automatically fetch stuff from the web by default. But the issue is not the WebBrowser! |
I've changed a little what @hluk did above, and its working for me [Command]
Automatic=true
Command="
copyq:
var imageUrl = str(data('text/plain'))
serverLog(\"info:: url: \" + imageUrl)
if (!imageUrl.startsWith('https://')) {
abort()
}
var reply = networkGet(imageUrl)
if (reply.status != 200) {
throw 'Failed to fetch image data.'
+ '\\nStatus code: ' + reply.status
+ '\\nError: ' + reply.error
}
serverLog(\"info:: status: \" + reply.status)
setData('image/png', reply.data)"
Icon=\xf15b
Name=Fetch Image
|
Describe the bug
In Vivaldi (and chromium I believe), the "copy image" function does not copy the actual image but an instead copies an html file embedding the image.
For example, the image
https://cdn.pixabay.com/photo/2018/03/19/15/04/wet-3240211_1280.jpg
will copy as<meta http-equiv="content-type" content="text/html; charset=utf-8"><img src="https://cdn.pixabay.com/photo/2018/03/19/15/04/wet-3240211_1280.jpg"/>
instead, which most applications (including github) accepts. But for these "images", copyq doesn't generate thumbnail previewsTo Reproduce
Steps to reproduce the behavior:
Expected behavior
copyq could either download the image component of the html file and store it, or copyq could continue its current behaviour but with generating and storing thumbnail previews.
Screenshots
Version, OS and Environment
(Get details from
copyq version
command if possible.)The text was updated successfully, but these errors were encountered: