ID:175833
 
So.. Im trying to figure out how to display png files on the browser.. I tried this but it didnt work
mob
Login()//when you log in
usr << browse_rsc('brush.PNG', "brush.PNG")
usr<<browse(Html_icons())
mob/proc/Html_icons()
return \
{"<html><b><center><body bgcolor = #330066><font color = white>
<center><img usr="brush.PNG"></center>"}

return

Any suggestions on how to fix this? And if so..is it possible to display Dmi files on the browser..or defined turfs,obj,mobs?
*edit*
Also is their a way to make the icon a button.. that will give the certain /atom the picture represents a variable.
Anyone have any suggestions or something i should look at? I'm awaiting your reply anyone, I really need this for an important system in my current project and i have no clue how to do this... html isnt my strong suit.

ETG
Erdrickthegreat2 wrote:
So.. Im trying to figure out how to display png files on the browser.. I tried this but it didnt work
> mob
> Login()//when you log in
> usr << browse_rsc('brush.PNG', "brush.PNG")
> usr<<browse(Html_icons())
> mob/proc/Html_icons()
> return \
> {"<html><b><center><body bgcolor = #330066><font color = white>
> <center><img usr="brush.PNG"></center>"}

> return
>
>

Any suggestions on how to fix this?

Change every instance of "usr" in that code snippet to "src", especially within the img tag in your HTML. There is no usr attribute in HTML. I also recommend you read usr Unfriendly on BYONDscape.


And if so..is it possible to display Dmi files on the browser..or defined turfs,obj,mobs?

Send the dmis to the client through browse_rsc. You should probably be sure to name it as a png file.
turf/tree
icon = 'tree.dmi'
desc = "A tree."
verb/look()
set src in view()
/* note that usr belongs here, because this is a
verb and we want to send output to the person
that uses the verb. */

usr << browse_rsc(icon, "tree.png")
usr << browse("<img src='tree.png'>[desc]")


Also is their a way to make the icon a button.. that will give the certain /atom the picture represents a variable.

You will want to look up the Topic() proc in the reference. I'll give you a brief demo here.
turf/tree
icon = 'tree.dmi'
desc = "A tree."
verb/look()
set src in view()
usr << browse_rsc(icon, "tree.png")
usr << browse("\
<a href=BYOND://?src=\ref
[src];usr=\ref[usr]>\
<img src='tree.png' border=0></a>
[desc]")

Topic(href, hlist)
/* I think you can use usr in Topic, but
when in doubt, don't use it! This
code looks up the mob who the
browser page was sent to. */

var/mob/M = locate(hlist["usr"])
if(M)
M << "You clicked [src]'s browser button!"
Shadowdarke's advice will help you, but you also need to fix that horrible HTML. You've got the <b> and <center> tags before <body>, which makes no sense; you also didn't close most of your tags, which is important. Don't forget to close <font>, and <b> (once you move it), and <body>, and <html>.

Lummox JR
In response to Lummox JR
Thanx for pointing that out.. I'm still real new with HTML so its difficult to implement it in a piece of my game.