Jump to content

loading images


Recommended Posts

The behaviour for this

 

BackImg.LoadFromURL('res/back1366.png');

 

has changed since the last update. It works fine in browsers (internal and external) but it no longer works in my app that uses chromium (CEF4). 

At the moment if I compile in older version - all good - recompile in newer version and the images don't load if I use my delphi based chromium browser.

Any suggestions about where to start looking for a solution? I am using the browser app for all of my SMS based software so this represents a significant problem for me.

 

Link to post
Share on other sites

I have since updated my CEF4 code with the latest version. No change.

I have made a very simply VCL sms program with an image loading a png. And it fails when opening via CEF4 browser. If I copy the index.html into a webserver then the browser will show images but not when it is a local file.

I have been using this browser for a number of years to display SMS index.html files so I would keen to have it resolved the change is the new SMS version.

Link to post
Share on other sites
  • Moderators

it is a cors error

Access to Image at 'file:///C:/Users/...../res/object.jpg' from origin 'null' has been blocked by CORS policy: Invalid response. Origin 'null' is therefore not allowed access.

would be very interested in getting a solution for this too

 

Link to post
Share on other sites

www.numberworks.com/downloads/ImageProblem.rar

Open SimpleBrowser.exe and insert these into address (change to suit location :) )

c:\ImageProblem\wwwCURRENT\index.html
c:\ImageProblem\wwwWORKS\index.html

 

If you go to wwwCurrent you will see image location - but no image. If you try wwwWORKS then you will see a green screen. Only difference between these two is which version of SMS was used.

Link to post
Share on other sites
  • Administrators

Ok,

29 minutes ago, jarto said:

@Czar Try removing line 311 from SmartCL.Controls.Image.pas:
 


SetCrossOrigin('Anonymous');

If it doesn't help, please zip the www-folders for me compiled with both the old and new version and send them to jt at smartmobilestudio.com

Removing this line fixes the problem, but there's something weird going on with that Simple Browser app:

This works: file:///C:/ImageProblem/wwwCURRENT/index.html

This does not: c:\ImageProblem\wwwCURRENT\index.html

Hmm.... now it works again with both paths. Weird. But anyway, that SetCrossOrigin -call is the source of the problem. Going to make sure that it's called only when needed.

Link to post
Share on other sites
  • Administrators
2 minutes ago, Czar said:

You sir are a life saver. I have tested my initial projects and they now work again as expected.

Can I assume that "SetCrossOrigin('Anonymous');" won't make a return in later versions :)

I'll find out if there was a reason it was added. This change came when @lennartfixed images to work with streams. If that is needed for streams, I'll simply move it so it's set on demand. If it's not needed at all, I'll remove it.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...