Jump to content

How to add custom avatar to profile?


homer09001

Recommended Posts

I've designed a Pilot ID Card style avatar that is dynamically updated, how can i put this in place of the pilot normal avatar?

I've tried editing the template for the profile by putting a standard php include to the custom script but it says it does not exist yet I know it does?

You can see the script here: http://testdomain.dth-scripts.com/Flyoasis/createid.php

Link to comment
Share on other sites

  • Administrators

Looks good, you can dynamically generate that with something liek:

createid.php?pilotid=XXX123

And inside, you can use the API with something like:

include 'core/codon.inc.php';

$pilotid = DB::escape($_GET['pilotid']);
$pilot_info = PilotData::getPilotData($pilotid);

// Now you can create that badge...
$pilotinfo->hub;
$pilotinfo->totalhours;
$avatar_link = PilotData::getPilotAvatar($pilotid);
//etc

Link to comment
Share on other sites

Looks good, you can dynamically generate that with something liek:

createid.php?pilotid=XXX123

And inside, you can use the API with something like:

include 'core/codon.inc.php';

$pilotid = DB::escape($_GET['pilotid']);
$pilot_info = PilotData::getPilotData($pilotid);

// Now you can create that badge...
$pilotinfo->hub;
$pilotinfo->totalhours;
$avatar_link = PilotData::getPilotAvatar($pilotid);
//etc

The only problem im having is where should i put my file so i can include it on the profile page because i want to place my ID card when the avatar is?

At the moment is says file not found when i try to include it, and i've tried placing my file in the Profile module folder

Also im having issues getting the pilot data, it pulls the avatar no problem but it isn't retrieving anything else?

function CreateID($pilotid){

include 'core/codon.config.php';
$pilotid = DB::escape($pilotid);
$pilotinfo = PilotData::getPilotData($pilotid);

// DEBUG ECHO
echo $pilotinfo->hub;
echo $pilotinfo->totalhours;
echo $pilotinfo->pilotid;

All 3 of those DEBUG Echo's don't print on the screen?

Link to comment
Share on other sites

  • Administrators

Ok i have worked out why it wasn't getting the pilot info, because its being given the full pilot id which is TVA0001 which is not how pilot ids aren't stored in the database so what suggestions are there for getting the id in the correct format to retrieve their data?

Pilot IDs are stored in the id column which is numeric only.

You can place it in a file called createid.php in the same folder as the index.php, or you can create a module. Either way is fine, but for simplicity's sake, you can create a file in the same directory as the index.php file

Link to comment
Share on other sites

Pilot IDs are stored in the id column which is numeric only.

You can place it in a file called createid.php in the same folder as the index.php, or you can create a module. Either way is fine, but for simplicity's sake, you can create a file in the same directory as the index.php file

ok that is where the file is placed at the moment in a folder called PilotIDs in the root folder but when i try to include the file in the Profile template, it says the createid.php file does not exist

Warning: include(../PilotIDs/createids.php) [function.include]: failed to open stream: No such file or directory in /home/.philadelphia/homer09001/testdomain.dth-scripts.com/PHPVMS/core/templates/profile_main.tpl on line 8

Warning: include() [function.include]: Failed opening '../PilotIDs/createids.php' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/.philadelphia/homer09001/testdomain.dth-scripts.com/PHPVMS/core/templates/profile_main.tpl on line 8

Fatal error: Call to undefined function createid() in /home/.philadelphia/homer09001/testdomain.dth-scripts.com/PHPVMS/core/templates/profile_main.tpl on line 9

on the other point of the pilot id number, how can i clean it so its only the actual numeric entry?

Its obviously done in PHPVMS before with the login script but i can work it out?

Link to comment
Share on other sites

Clean it? Depends where you're getting it from. And make sure about the path it's case-sensitive

Hang on a sec, i think i've been getting the id the wrong way, i can't check until i can get the id card showing in the profile.

regarding the placement of the file:

phpVMS: http://testdomain.dth-scripts.com/PHPVMS/

createid.php: http://testdomain.dth-scripts.com/PHPVMS/PilotIDs/

Link to comment
Share on other sites

  • Administrators

Hang on a sec, i think i've been getting the id the wrong way, i can't check until i can get the id card showing in the profile.

regarding the placement of the file:

phpVMS: http://testdomain.dt...pts.com/PHPVMS/

createid.php: http://testdomain.dt...HPVMS/PilotIDs/

The ID if you're linking to it from the pilot profile, just use $pilot->pilotid, which is the numeric ID

Link to comment
Share on other sites

The ID if you're linking to it from the pilot profile, just use $pilot->pilotid, which is the numeric ID

Fatal error: Cannot redeclare codon_autoload() (previously declared in /home/.philadelphia/homer09001/testdomain.dth-scripts.com/PHPVMS/core/classes/autoload.php:42) in /home/.philadelphia/homer09001/testdomain.dth-scripts.com/PHPVMS/core/classes/autoload.php on line 65

this is when this include is in my script: include 'core/codon.config.php';

without it i can load the profile page but my image is broken?

Edit: if i change include 'core/codon.config.php'; to require_once it lets me load the Profile page but my image is still broken????

Edited by homer09001
Link to comment
Share on other sites

  • Administrators

this is when this include is in my script: include 'core/codon.config.php';

without it i can load the profile page but my image is broken?

Edit: if i change include 'core/codon.config.php'; to require_once it lets me load the Profile page but my image is still broken????

How are you linking to the change image page? Is it an <img src="">?

Link to comment
Share on other sites

  • Administrators

no just

<? include "PilotIDs/createid.php"; ?>

I've tried wrapping it in an img tag but that yields the same result?

try

<img src="/PilotIDs/createid.php?pilotid=<?php echo $pilot->pilotid;?>" />

Then inside that createid.php with that above code to include the codon.inc.php and the other stuff, and then create your image

Link to comment
Share on other sites

try

<img src="/PilotIDs/createid.php?pilotid=<?php echo $pilot->pilotid;?>" />

Then inside that createid.php with that above code to include the codon.inc.php and the other stuff, and then create your image

Thanks Nabeel got it eventualy

Has to change the code you gave me a bit to get it to work:

<img src="/PHPVMS/PilotIDs/createid.php?pilotid=<?php echo $userinfo->pilotid;?>" />

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...