Forums

BF2Statistics.com :: Forums :: Bugs

Player Images are missing

THE_WUQKED

Joined: Mon Feb 13 2006, 03:25AM
Posts: 96
Just see yourself:
http://cdb.bf2-warzone.com/bf2statistics/player.php?pid=45702707

Seems like the used Chinese Assault Pic is missing (OR the code is incorrect.)
No idea if it is the only one, but just noticed this one.

Btw: Why are the pics of one class totally different (background), depending on the weapon they use?

EDIT: Just noticed the real problem:
The prob is, that SHSN_Snakeman's fav. Kit is Assault, BUT fav. weapon is sub.machinegun.
In eA Ranking my fav. kit is Engineer, but weapon is Assault rifle. - Looking at the code this would/could make trouble as well.
Solution idea: Just post the fav. kit with default main gun, (if his fav. weapon is in another kit) - or just the pistol, cause each class got the pistol.

[ Edited Tue Mar 07 2006, 04:29AM ]

THE_WUQKED

Joined: Mon Feb 13 2006, 03:25AM
Posts: 96
Ok,
I wrote a temporary fix for this bug:
- Download this file: http://rapidshare.de/files/14911631/armpicfix.zip.html
(Sorry that it is a German site.)
- extract it to your bf2stats folder (same fodler as player.php)
- edit your player.php line 22 (default line!):
delete:
<img src="<?php echo $resources_dir ?>/graphics/soldiers/<?php echo $stats->stat('farm') ?>_<?php $stats->stat('fkit') ?>_<?php $stats->stat('fwea') ?>.jpg" alt="<?php htmlspecialchars($stats->stat('nick')) ?><br>Army: <?php echo $stats->armyKey[$stats->getStat('farm')] ?><br>Kit: <?php echo $stats->kitKey[$stats->getStat('fkit')] ?><br>Weapon: <?php echo $stats->weaponKey[$stats->getStat('fwea')] ?>" height="280" width="190">
replace it with:
<?php include 'armpicfix.php';?>



Comments:
- I know, this fix is uggly coded, but before bf2statistics I never wrote a php-site.
- This fix seems to work on our own stats site, but no 100% guarantee.
- what it does is: If such a prob appears, like the one in the first post, it just shows the soldier with the pistol.
- I noticed, that indeed at least two pics are missing: the US medkit and US wrench pic.

[ Edited Tue Mar 07 2006, 06:34AM ]

Get First Aid Here!!
MrNiceGuy


Joined: Tue Jan 24 2006, 01:32PM
Posts: 619

Thanks for your input... But this is really not needed, the missing pic's are only at the beginning, when u dont have much stats at all, so i didnt bother to make any fix for it... It will resolve itself when u get more stats, wich is the purpose of the system.

Medkit and wrench, will be wery hard to get as fav. weapon... unless you do nothing else than healing and repair...
THE_WUQKED

Joined: Mon Feb 13 2006, 03:25AM
Posts: 96
? At the beginning?
Sorry, that I have to dissapoint you, BUT:
My EA Ranked stats are as follows:
Total Time played: over 250hours
Fav. Kit: Engineer: over 130h
Fav weapon: Assault Rifle: over 35hours

With those stats, the pic would be missing as well in bf2statistics

Reason: As Engineer I drive Tank most of the time. For Inf I use the Assault or Medic.
So NOO, I don't think that this prob fixes after playing long enough. (I'm not the only one those stats)

See my EA Stats here:
http://bf2s.com/player/43416310/

[ Edited Tue Mar 07 2006, 04:14PM ]

THE_WUQKED

Joined: Mon Feb 13 2006, 03:25AM
Posts: 96
Just checked the bf2statistics Leaderboard:
In the Top 10 Players this bug occurs for 3 players, but see yourself:
HavoC_nMe, 8370: http://cdb.bf2-warzone.com/bf2statistics/player.php?pid=43973273
HazE_nMe, 8175: http://cdb.bf2-warzone.com/bf2statistics/player.php?pid=38994508
**DOC**Micha, 7142: http://cdb.bf2-warzone.com/bf2statistics/player.php?pid=46362341

Sure, the weapon times are quite close, but HazE_nMe's kit times are not, for example.
It's only out of the top 10 anyway.

so you see: This is a common prob, and I'd say it'll be a good idea to add a fix in one of the next web-interface realeses.
Btw, bf2s.com (EA Ranked Stats Site) had the same prob in the past, if I remember correct.
Mal

Joined: Tue Apr 18 2006, 05:15AM
Posts: 63
hey WUQKED you still have that armpicfix.zip pkg somewhere? the rapidshare link seems to have expired and the idea sounds pretty good.

I tried this with a "if file_exists() else show-a-default-pic" but my php skills let me down

THE_WUQKED

Joined: Mon Feb 13 2006, 03:25AM
Posts: 96
The file is now added to this post. - Hope it won't be deleted like the rapidshare file...
1145456325_337_FT1053_armpicfix.zip
Mal

Joined: Tue Apr 18 2006, 05:15AM
Posts: 63
good work, thanks a lot.
THAT guy!
Groda_Lotsapot

Joined: Mon Feb 26 2007, 05:08PM
Posts: 40
I wrote a quick fix for everyone who hosts their own images (as from what I read, most of us do).
Add this in before the table that shows the image for your player in player.php (around line 19)
<?php
$image_file = $stats->getStat('farm') . "_" . $stats->getStat('fkit') . "_" . $stats->getStat('fwea') . ".jpg";
$image_url = $resources_dir . "/graphics/soldiers/" . $image_file;

if ($resources_dir == "./resources" ) { // File is on the local system
// Figure out what the local path of the file would be
$image_path = $_SERVER["APPL_PHYSICAL_PATH"] . 'resources\\graphics\\soldiers\\' . $image_file;

if (!file_exists($image_path)) { //Cannot find the file on the drive. Substitute default
$image_url = $resources_dir . "/graphics/soldiers/default.jpg";
}
}
?>

Then, instead of having
img src="<?php echo $resources_dir ?>/graphics/soldiers/<?php echo $stats->stat('farm') ?>_<?php $stats->stat('fkit') ?>_<?php $stats->stat('fwea') ?>.jpg"
put
img src="<?php echo $image_url ?>"

Now if it can't find the image file in the folder, it will show default.jpg instead (create one in the same folder as your soldiers). I made a nice one from the BF2 Site Fan Kit (hehehe... free graphics)

I know it's not the prettiest, but I've only learned PHP from fixing errors in the BF2Statistics, and my previous programming knowledge in other languages.
Website

Moderators: MrNiceGuy, Twhyman, Chump, hurr1k4ne, The Shadow, Wilson212

<< Previous thread | Next thread >>

Jump:     Back to top