Jump to content

HTML image from link


Piorun

Recommended Posts

Posted

Hi guys,

I read that i can't load remote content for my local website but is there any solution to make this possible? For ex. i want to get gravatar from link

[url=https://s.gravatar.com/avatar/0cb95b1047a5e33381d7cda457e57b51?s=80]https://s.gravatar.com/avatar/0cb95b104 ... 57b51?s=80[/url] 

Meybe it is possible through Lua? I mean

fetchRemote 

Pls answer :)

Posted

Ok so then what? I mean how to write JS code? I mean what function / tags use to do that (im not noob in html / js so chill :D).

And i'm using jQuery.

Posted

You don't need to write JS code.

Here's an example:

local image_data 
fetchRemote('https://s.gravatar.com/avatar/0cb95b1047a5e33381d7cda457e57b51?s=80', function(err, data) 
 if (err) then print(err) return end 
 img_data = data 
end) 
  
addEventHandler('onPlayerJoin', root, function() 
 triggerLatentClientEvent(source, 'downloadImage', resourceRoot, img_data) 
end) 

On the client, receive the image_data, create a texture and draw it.

local image = dxCreateTexture(img_data) 

Posted

I think you can't in any way using JS, since the local website can't access any remote source.

A possible solution would be to use MTA to download the images needed and then edit the HTML document to load the image.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...