[SOLVED] Img Src Not Working.

Hello,

I am working on new dashboard and i add pictures to top. and the code i used see below.  But picture is broken… you can see in the link. Seems like not seeing pilot code. When i check broken pic link shows right directoryy but .png Little help please. Thanks.

\<img class="" alt="Avatar" src="\<?php echo SITE\_URL.AVATAR\_PATH.'/'.$pilotcode.'.png';?\>" height="90" /\>

https://image.prntscr.com/image/0UPZjLRMS0K0D4-3cT0JUQ.png

You’ll want to use the getPilotAvatar in the PilotData class, try using the code below:

\<img height="50px" width="50px" style="" alt="Pilots Avatar" src="\<?php echo PilotData::getPilotAvatar($pilotid);?\>" /\>

 

1 hour ago, OmerAslan said:

Hello,

I am working on new dashboard and i add pictures to top. and the code i used see below.  But picture is broken… you can see in the link. Seems like not seeing pilot code. When i check broken pic link shows right directoryy but .png Little help please. Thanks.

<img class=“” alt=“Avatar” src=“<?php echo SITE_URL.AVATAR_PATH.‘/’.$pilotcode.‘.png’;?>” height=“90” />

https://image.prntscr.com/image/0UPZjLRMS0K0D4-3cT0JUQ.png

on image put right click and copy the image link, paste here pls

9 hours ago, ProSkyDesign said:

on image put right click and copy the image link, paste here pls

http://localhost/crew/lib/avatars/.png

path is right. But not seeing the pilot code.

11 hours ago, t_bergman said:

You’ll want to use the getPilotAvatar in the PilotData class, try using the code below:

<img height=“50px” width=“50px” style=“” alt=“Pilots Avatar” src=“<?php echo PilotData::getPilotAvatar($pilotid);?>” />

 

I try but gives me wrong path my friend. My avatar going to localhost/crew/lib/avatars

Hey bud,

Gonna go off of a gut feeling and guess that the variables $pilotcode or $pilotid aren’t defined. So give this a try instead:

\<img height="50px" width="50px" style="" alt="Pilots Avatar" src="\<?php echo PilotData::getPilotAvatar(PilotData::getPilotCode(Auth::$pilot-\>code, Auth::$pilot-\>pilotid));?\>" /\>

Or a cleaner way to do it is:

\<?php $pilot\_id = PilotData::getPilotCode(Auth::$pilot-\>code, Auth::$pilot-\>pilotid);?\> \<img height="50px" width="50px" style="" alt="Pilots Avatar" src="\<?php echo PilotData::getPilotAvatar($pilot\_id);?\>" /\>

 

1 Like

5 minutes ago, magicflyer said:

Hey bud,

Gonna go off of a gut feeling and guess that the variables $pilotcode or $pilotid aren’t defined. So give this a try instead:

<img height=“50px” width=“50px” style=“” alt=“Pilots Avatar” src=“<?php echo PilotData::getPilotAvatar(PilotData::getPilotCode($pilot->code, $pilot->pilotid));?>” />

Or a cleaner way to do it is:

<?php $pilot_id = PilotData::getPilotCode($pilot->code, $pilot->pilotid); ?> <img height=“50px” width=“50px” style=“” alt=“Pilots Avatar” src=“<?php echo PilotData::getPilotAvatar($pilot_id);?>” />

 

both codes goes to noavatar.png from here

but my avatar path when i upload avatar goes here  localhost/crew/lib/avatars

Omer, try again. I made a mistake of not including the Auth:: class reference when accessing the $pilot var. Should be fixed. Also, Out of the blue give this a try:

 

\<?php $pilotcode = PilotData::getPilotCode(Auth::$pilot-\>code, Auth::$pilot-\>pilotid); ?\> \<img class="" alt="Avatar" src="\<?php echo SITE\_URL.AVATAR\_PATH.'/'.$pilotcode.'.png';?\>" height="90" /\>

 

1 Like

12 minutes ago, magicflyer said:

Hey bud,

Gonna go off of a gut feeling and guess that the variables $pilotcode or $pilotid aren’t defined. So give this a try instead:

<img height=“50px” width=“50px” style=“” alt=“Pilots Avatar” src=“<?php echo PilotData::getPilotAvatar(PilotData::getPilotCode(Auth::$pilot->code, Auth::$pilot->pilotid));?>” />

Or a cleaner way to do it is:

<?php $pilot_id = PilotData::getPilotCode(Auth::$pilot->code, Auth::$pilot->pilotid);?> <img height=“50px” width=“50px” style=“” alt=“Pilots Avatar” src=“<?php echo PilotData::getPilotAvatar($pilot_id);?>” />

 

Done my friend. Thank you so much for your help. and thanks to   and .