Jump to content

[SOLVED] Img Src Not Working.


OmerAslan

Recommended Posts

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

Edited by OmerAslan
Link to comment
Share on other sites

  • Moderators
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

Link to comment
Share on other sites

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

FmeBETJeReyEE4nErbLS-w.png

Link to comment
Share on other sites

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);?>" />

 

Edited by magicflyer
  • Like 1
Link to comment
Share on other sites

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

FmeBETJeReyEE4nErbLS-w.png

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

Link to comment
Share on other sites

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" />

 

Edited by magicflyer
  • Like 1
Link to comment
Share on other sites

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 t_bergman and ProSkyDesign

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...