Help with img src

hey hey, I’m trying to display an image, that I uploaded into my directory files, on my website. However, I’m not being able to do this… Here is the code:

<img data-toggle="tooltip" data-placement="left" title="<?php echo $array->usr_tipo; ?>" style='width:50px;height:50px;'
src=<?php if($array->usr_tipo == 'Licença'){echo "/imagens/licenca.png";}if($array->usr_tipo == 'Exonerado'){echo "/imagens/exoneracao.png";}if($array->usr_tipo == 'Mudança de nick'){echo "/imagens/nick.png";}?>'>

The image should be displayed here:

Any idea to solve it? Am I missing anything?

this image that is appearing (the green one) is hosted on imgur, but I’d like to host these images on my own site, to avoid losing them on imgur.

Hi there,

I do not use PHP, but what does your site’s directory look like? Is the pathing correct?

I don’t know if we could call the CPanel a directory, but that’s where I uploaded the images, with the other files of code, then I used the link to call the image, but it’s not working…

Could you share a link to your website, please?

Sure! It’s rhccorporation.com.br

Hi, friend.

So, I am not too sure how to help as the page you are having problems with is not accessible to me. The only thing I would suggest is to use the mighty tool Google and perhaps some StackOverflow.

(Side note: Is this website for a Habbo Hotel group? If so, I am flabbergasted by the blast to the past I just experienced, lol)

Hahaha, yep! This is for a Habbo group. I’m helping some friends who still play it. We are from the Habbo from Brazil/Portugal. What about you? In what hotel had you played?
And concerning the code, I decided to continue hosting the image on Imgur. Thanks for your support.

1 Like

Suppose I had an array declared somewhere in my php like:

$myArray = array("some thing"=>"abc", "another"=> 44, "usr_tipo" => "Exonerado" );

then I could do something like:

<img src="<?php
if ($myArray["usr_tipo"] == "Licença") {
    echo htmlspecialchars("/imagens/licenca.png"); 
} elseif ($myArray["usr_tipo"] == "Exonerado") {
    echo htmlspecialchars("/imagens/exoneracao.png"); 
} elseif ($myArray["usr_tipo"] == "Mudança de nick") {
    echo htmlspecialchars("/imagens/nick.png"); 
} else {
    echo htmlspecialchars("/imagens/default.png");
}
?>" >

Remarks:

1 Like

I played Habbo from about 2008-2010 in the US. :joy: Blaaaast from the past, lol

mtrtmk is super knowledgeable and I reckon the given advice should help you out!