Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

How to save image by of an <img tag

Post Reply
thefunkyjoint
Posts: 513
Joined: Thu Aug 10, 2017 12:40 pm

How to save image by of an <img tag

Post by thefunkyjoint »

Hello,

I'm in a web page that has some images i'd like to save locally. But in this page the <img tags , does not have a direct link, they are like this :

<img class="media-photo" src="blob:https://website.com/b96f881c-1871-441f-a999-33305ead7fbd">

If i try to navigate to "https://website.com/b96f881c-1871-441f-a999-33305ead7fbd", i get a 404 error.

How can i download the image in this case?

Many thanks !
User avatar
salvadordf
Posts: 4563
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to save image by of an <img tag

Post by salvadordf »

Hi,

Try calling TChromiumCore.StartDownload with the whole URL, including the "blob:" prefix.
thefunkyjoint
Posts: 513
Joined: Thu Aug 10, 2017 12:40 pm

Re: How to save image by of an <img tag

Post by thefunkyjoint »

Hello,

Thanks a lot, it works BUT won't let me specify where i want to download the file, looks like it goes to the 'Downloads' folder, with a random name.

Any way to specify name / location ? :?
User avatar
salvadordf
Posts: 4563
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to save image by of an <img tag

Post by salvadordf »

I just added a menu option to download a file in the MiniBrowser demo which calls StartDownload.

I copied the image URL from https://codesandbox.io/p/sandbox/image-blob-example-0igon?file=%2Fsrc%2FApp.js
and then I used the new menu option.

The TChromium.OnBeforeDownload and TChromium.OnDownloadUpdated events were triggered and the save dialog was shown because TChromium.OnBeforeDownload calls callback.cont(TempFullPath, True);

The last boolean parameter tells Chromium to show a dialog.
You do not have the required permissions to view the files attached to this post.
thefunkyjoint
Posts: 513
Joined: Thu Aug 10, 2017 12:40 pm

Re: How to save image by of an <img tag

Post by thefunkyjoint »

Thank you very much Salvador, it worked !

As a plus, is there a way to hide these download status msgs ? :D

https://ibb.co/v55RShB
User avatar
salvadordf
Posts: 4563
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to save image by of an <img tag

Post by salvadordf »

Set TChromiumCore.DownloadBubble to STATE_DISABLED
thefunkyjoint
Posts: 513
Joined: Thu Aug 10, 2017 12:40 pm

Re: How to save image by of an <img tag

Post by thefunkyjoint »

Thank you again ! This project never ceases in surprise me :D
Post Reply