Jump to content

[HELP] guiCreateStaticImage load images from website?


PlayAkoya

Recommended Posts

Hi,

Load images from website? For recordable from Google Images: http://www.next-gamer.de/wp-content/upl ... /url17.jpg

--Useful Function: 
  
function getImageFromWebsite(url) 
  
    if (url) then 
        local getImageData = --[FUNCTION give the image?? HELP ME pls..] 
    else 
        local getImageData = nil 
    end 
    return getImageData 
end 
  
guiCreateStaticImage(0, 0, 500, 281, tostring(getImageFromWebsite), true) 

Hope someone here has a chance?

Link to comment

Server:

local img_data 
  
addEventHandler('onResourceStart', resourceRoot, function() 
 fetchRemote('http://www.next-gamer.de/wp-content/uploads/2015/05/url17.jpg', function(data, err) 
  if (err ~= 0) then return end 
  img_data = data 
 end) 
end) 
  
addEventHandler('onPlayerJoin', root, function() 
 if (not img_data) then return end 
 triggerClientEvent(source, 'drawImage', resourceRoot) 
end) 

Now image data is a string, you can trigger the string to the client and then use dxCreateTexture and dxDrawImage to draw it.

local texture 
  
addEvent('drawImage', true) 
addEventHandler('drawImage', root, function(img_data) 
 texture = dxCreateTexture(img_data) 
 if (not texture) then return end 
 addEventHandler('onClientRender', root, drawTexture) 
end) 
  
function drawTexture() 
 dxDrawImage(0, 0, 320, 240, texture) 
end 

Link to comment

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...