Page 1 of 1

How to save image by of an <img tag

Posted: Fri Mar 14, 2025 11:56 am
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 !

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

Posted: Fri Mar 14, 2025 3:39 pm
by salvadordf
Hi,

Try calling TChromiumCore.StartDownload with the whole URL, including the "blob:" prefix.

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

Posted: Fri Mar 14, 2025 4:39 pm
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 ? :?

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

Posted: Sat Mar 15, 2025 2:45 pm
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.

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

Posted: Sun Mar 16, 2025 1:05 pm
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

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

Posted: Mon Mar 17, 2025 2:33 pm
by salvadordf
Set TChromiumCore.DownloadBubble to STATE_DISABLED

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

Posted: Tue Mar 18, 2025 10:30 pm
by thefunkyjoint
Thank you again ! This project never ceases in surprise me :D