I would like to get the RGB pixel data of an image that I drag-and-drop to the browser, i.e. an image from my harddrive that is in the Chrome Active Tab.
I am not sure what permission I should ask for it in the manifest file, since the address of the image is "file:///C:/Users..."
If the image is on the web, then I can ask for cross-origin permission such as "https://*/*", and everything works, but for my local image I get an error: "The canvas has been tainted by cross-origin data."
To get the pixel data I followed the direction of:
How to get a pixel's x,y coordinate color from an image?
Thanks
Related
I sent a request for a website and on that website is a captcha image (the text ones) and I wanted to be able to download the image directly from the webpage. However, when I attempt to save the image (manually), a completely different one is downloaded instead. All the images share the same URL.
Url: https://www.unovarpg.com/library/captcha/captcha.php?.png
There are a few things that will give me the correct image, however:
Dragging and dropping the image directly to my file manager
going in the Sources tab in inspect element and saving from there (it downloads it as .php but changing the extension to .png works)
copying the image as data URI in Sources tab
copying the image request response in the Network tab
What I want to do is to create a direct link URL to a mp3 file which is located on my Google Drive and use it on Audio object of HTML5, but I get 403 error.
I know that when one tries to create a link of a file located on Google Drive, it creates not a direct URL to the file but a URL for viewing the file through a viewer such as
https://drive.google.com/file/d/<file ID>/view?usp=sharing
I googled to find it is possible to rewrite it into a direct link URL like this:
https://drive.google.com/uc?id=<file ID>
I set this URL in the src property of my audio element. However, when I try play() method, the following error is thrown:
GET https://drive.google.com/uc?id=<file ID> 403
myProject.html:1 Uncaught (in promise) DOMException: Failed to load because no supported source was found.
So I tried to access to the URL https://drive.google.com/uc?id=<file ID> from my browser.
Then, I got this:
403. That’s an error.
We're sorry, but you do not have access to this page. That’s all we know.
I tried many times so it is not likely that I'm mis-pasting the <file ID>.
What should I do to create a valid direct link URL of the file?
I would appreciate for any information.
Progress
I got what was wrong.
The problem was that a file on Google Drive can be accessed only from the user who is authorized, which means only the owner of the Google account can access the file URL.
I tried to access it from Chrome Browser which is associated with the Google account, then, the error didn't occur.
However, I want to serve this file to all the people.
What should I do to give permission for access to other people?
You understand that Google drive is not a file hosting service right? This solution is not going to be very stable even if you do get it to work.
For it to work your going to need to set the file public so that everyone can access it. Then i would be willing to bet you will need an API key to do this in the long run.
Also remember that file id is not stable it can change in the future if for example you upload the file.
I solved this on my own. I right clicked the file, clicked Get link, and changed the authorization selection from Restricted into Anyone with the link. Then, the 403 error vanished for the access from anyone.
Please help me to understand the following, I have a node.js app which I want to run on Google Cloud App Engine, this app will contain some images which are planned to be stored on Google Cloud Storage. On my sample app once I upload an image and get a url (mediaLink or selfLink) image is being downloaded.
Why is that? Each download each click costs money I understand google, but is there any way to make url just show images NOT to be downloaded?
Saving a file from Google Cloud Storage is the same as displaying it. Both action require transferring the content of the image to the device for display or saving.
The action of displaying an image or popping up a save as dialog is controlled by HTTP headers. For example if you have the HTTP header content-type set incorrectly (not as an image) then some browsers will save the file. If you want your image files to be displayed as images set the headers correctly for the type of picture. For PNG files set the header contenty-type: image/png.
You can also force a download with the content-disposition: attachment header.
In summary, it does not matter if you are displaying an image or saving it to local storage, it will cost you money. Both actions requiring downloading (transferring) the contents of the file across the Internet.
In Episerver 11, the thumbnails for jpegs are broken. In the media library, they display as broken images:
And I see this in the browser tools:
Failed to load resource: the server responded with a status of 404 ()
On the actual url
https://mysite.mydomain.com/episerver/CMS/Content/siteassets/heros/myimage.jpg,,26/Thumbnail?epieditmode=False?1527614597161
On an actual web page and in the Image editor, they display fine. Not entirely sure how the thumbnail system works.
Make sure your thumbnails are saved as png's.
I had the same problem, due to a third-party library for image resizing.
It turns out Episerver (CMS version 9.12), always wants to save the thumbnail for an image in a png format.
Run the scheduled job "Clear Thumbnail Properties" in admin
From the documentation
You can clear generated thumbnail images in the Products list and
Media list views and add them again with the Clear Thumbnail
Properties job. Run this job manually if you experience problems with
refreshing thumbnails, such as on the website and BLOB-supported
content.
I am trying to build a Facebook chatbot that sometimes sends image as response to user queries. These images are from the response of API requests from my node server and don't sit at my server end.
I am using Graph api to send messages automatically from the chatbot whenever a postback is received.
I am able to get image response back, but the images are not responsive. I have attached a picture for reference.enter image description here
From the Facebook documentation, I don't see any parameter that dynamically changes the image size. As the images I receive are from an external api and not from my server, is there a way around to change the image size and display the image with new dimensions in my chatbot.
Thanks in advance!
There is no image size exactly, but you can set the aspect ratio of the image, which will crop it to that ratio in the template. payload.image_aspect_ratio and the options are horizontal (1.91:1) or square (1:1).
You could also fetch the image with a third party API like Cloudinary, which will do image transforms on the fly.