TWebImageControl fails from the first moment.

Steps to reproduce the failure:

  • Create an empty application of type bootstrap.
  • Save all the forms and the project.
  • In the default form, add the following HTML code to the body:
<a class="navbar-brand" href="index.html">
     <img id="exampleimg" class="brand-img img-fluid" src="" alt="brand" />
</a>
  • Now, in the properties of the TWebImageControl in the form set the next:

ElementClassName = brand-img
ElementID = exampleimg

  • try to execute the application with F9.

The program is going to stop in the next part without error.

I included the example project to verify the malfunction.

TestApp.zip (29.1 KB)

The error in the navigator is the next:

ERROR
Uncaught [object Object] | FMessage::Error loading image FHelpContext::0 FJSError::Error: Error loading image FStack::Error: Error loading image at Object.Create$1 (http://localhost:8000/Project1/Project1.js:3432:23) at c.$create (http://localhost:8000/Project1/Project1.js:337:19) at Object.HandleError (http://localhost:8000/Project1/Project1.js:51978:124) at HTMLImageElement.cb (http://localhost:8000/Project1/Project1.js:241:26)
at http://localhost:8000/Project1/Project1.js [51978:95]

Remember: I do not assign any image to the component.

If I assign the Picture property, the problem is the same, but the error message in the navigator is the next one:

ERROR
Uncaught [object Object] | FMessage::Error loading image Unit5.WebImageControl1.Picture.svg FHelpContext::0 FJSError::Error: Error loading image Unit5.WebImageControl1.Picture.svg FStack::Error: Error loading image Unit5.WebImageControl1.Picture.svg at Object.Create$1 (http://localhost:8000/Project1/Project1.js:3432:23) at c.$create (http://localhost:8000/Project1/Project1.js:337:19) at Object.HandleError (http://localhost:8000/Project1/Project1.js:51978:124) at HTMLImageElement.cb (http://localhost:8000/Project1/Project1.js:241:26)
at http://localhost:8000/Project1/Project1.js [51978:95]

Update.

I made this in the form, and the error disappears, but the image is not shown.

procedure TForm5.WebFormCreate(Sender: TObject);
begin
      WebImageControl1.URL := '';
end;

Update.

I've changed the code of the FormCreate with this:

procedure TForm5.WebFormCreate(Sender: TObject);
begin
   //WebImageControl1.URL := '';
   WebImageControl1.LoadFromURL('http://localhost:8000/Project1/eture-logo.webp');
end;

And now the program works well, but...

What about using the image loaded at design time?

Is it possible? How?

When there is no image set for an IMG element, the browser triggers by default an error. We did the improvement to avoid raise exception in this case (when URL = empty).
When a picture is set at designtime, we cannot see an issue here.

Please. See the example program I send to you.

When you let the image empty during design time and execute the program, it breaks with an exception. I think that is the first component that needs one line of code written by the programmer to run correctly.

You can also follow the steps I described. The programmer did not write any lines, and when you run it, an exception arises.

Maybe this is an issue?

I have answered that we did an improvement for when the image URL is left empty.