OmerAslan Posted July 23, 2017 Report Share Posted July 23, 2017 (edited) 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 July 24, 2017 by OmerAslan Quote Link to comment Share on other sites More sharing options...
t_bergman Posted July 23, 2017 Report Share Posted July 23, 2017 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);?>" /> Quote Link to comment Share on other sites More sharing options...
Moderators ProSkyDesign Posted July 24, 2017 Moderators Report Share Posted July 24, 2017 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 Quote Link to comment Share on other sites More sharing options...
OmerAslan Posted July 24, 2017 Author Report Share Posted July 24, 2017 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. Quote Link to comment Share on other sites More sharing options...
OmerAslan Posted July 24, 2017 Author Report Share Posted July 24, 2017 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 Quote Link to comment Share on other sites More sharing options...
magicflyer Posted July 24, 2017 Report Share Posted July 24, 2017 (edited) 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 July 24, 2017 by magicflyer 1 Quote Link to comment Share on other sites More sharing options...
OmerAslan Posted July 24, 2017 Author Report Share Posted July 24, 2017 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 Quote Link to comment Share on other sites More sharing options...
magicflyer Posted July 24, 2017 Report Share Posted July 24, 2017 (edited) 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 July 24, 2017 by magicflyer 1 Quote Link to comment Share on other sites More sharing options...
OmerAslan Posted July 24, 2017 Author Report Share Posted July 24, 2017 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.