ID:2298116
 
Code:
mob/proc
SetRGPicvis()
usr.RGPic = null
var/M = "Species Images/[RGRaceID].png"
if(fexists(M))
var/icon/I = file(M)
usr.RGPic = I
else
usr.RGPic = 'missing.dmi'
return

//--------------------------------------------------------

/<center><img src="\ref[usr.RGPic]" width="50%"></center>


Problem description:

O.k. ready to look stupid being I have looked over the forums and over the libraries and I can't seem to figure this out. The problem I am having is that I am trying to get the file in the folder to show up in run time within a browser base. Mainly this is to get rid of the overhead of additional pictures loaded in at compile and pull them off the server at run time. I have already for this working with an Output window but it would look cleaner if I could get them back into the web pages.

The problem is after all my trouble shooting is getting to recognize a PNG or a DMI file as an icon. It will load in the file and show it if it is directly posted into the output. But it will not show on the \ref.

I have tried this a number of ways even with the image() and icon(). I have tried new() into a icon and image var and still nothing. Really it is working but I would like to improve the front end. I feel this is something I am just missing.

I have tested isicon() with the setup finding out the Dmi compiled in program for the missing pictures does work in the browser setting but when the external pictures it used, it shows as file. Thus \Ref doesn't pick it up.

So if anyone can help it would be nice. Thanks for reading this over.

P.S. I have also tried working with the input command to try that way, but it will only work on the server computer that has the files, not the clients linking to it. So I figure it is something I am not inputting right.
var/icon/I = icon(file(M))



Embedding in text:

"\icon[usr.RGPic]"
Thanks I will try that, I was missing the second part.

O.k. update, I tried this
mob/proc
SetRGPicvis()
usr.RGPic = null
var/M = "Species Images/[RGRaceID].png"
if(fexists(M))
var/icon/I = icon(file(M))
usr.RGPic = I
else
usr.RGPic = 'missing.dmi'
return

//--------------------------------------------------------

/<center><img src="\icon[usr.RGPic]" width="50%"></center>


Being I actually have the code with me today. It came out with another dead link. When I though it into an external HTML editor it thought out this in the picture location.

<center><img src="" width="50%" /> <br />


and it should be like this to appear.

<img src="file:///C:/Users/[User Name]/Documents/BYOND/cache/missing.dmi" width="50%" />


I copied it from the program but some reason it is not working. I have tried other pictures and code right now. So I don't know how much this might help. Mostly all I am seeing is when it uses the code normally in the browser it isn't working. So I figure I might be doing something wrong.

Thanks for the help though, it was nice to try something else.
No, you can't put \icon[] in an img src. You need to just put it as raw text into the output.
Oh o.k. , Sorry that was the part I wasn't understanding.