Piorun Posted September 17, 2015 Share Posted September 17, 2015 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 Link to comment
JR10 Posted September 17, 2015 Share Posted September 17, 2015 Fetch it server-side, store it in a variable, and send it to the client with triggerLatentClientEvent whenever needed. Link to comment
Piorun Posted September 17, 2015 Author Share Posted September 17, 2015 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 ). And i'm using jQuery. Link to comment
JR10 Posted September 17, 2015 Share Posted September 17, 2015 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) Link to comment
Piorun Posted September 17, 2015 Author Share Posted September 17, 2015 Ye ye i know but i said i want to use it in my local website. So how to write JS code (i know how to execute) to show that image? Link to comment
JR10 Posted September 17, 2015 Share Posted September 17, 2015 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. Link to comment
Piorun Posted September 17, 2015 Author Share Posted September 17, 2015 Ye i thought about it and i think i will use it. Thanks for any reply Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now