/    Sign up×
Community /Pin to ProfileBookmark

Dynamic Image Loading SLOW

Can anybody tell me why my Dynamic Image takes AGES to load?

This is my script:

[code=php]<?php
require_once(‘stats.class.php’);
$gamertag = $_GET[‘gt’];
$gtfix = str_replace(‘-‘, ‘ ‘, $gamertag);

$gamertag = $_GET[‘gt’];
$gtfix = str_replace(‘-‘, ‘ ‘, $gamertag);
header(‘Content-type: image/png’);
$im = imagecreatefrompng(“stats.png”);

if(!$im) { die; }

$black = imagecolorallocate($im, 0, 0, 0);
$white = imagecolorallocate($im, 255, 255, 255);
$red = imagecolorallocate($im, 255, 0, 0);

$width = imagesx($im);
$height = imagesy($im);

$font = ‘segoesc.ttf’;
$verdana = ‘verdana.ttf’;

$highlevel = “Highest Level: “.halo3stats($gtfix, “highestlevel”);
$totalgames = “Total Games: “.halo3stats($gtfix, “totalgames”);
$rank = halo3stats($gtfix, “rank”);
$totalexp = “EXP: “.halo3stats($gtfix, “totalexp”);
$kills = “Kills: “.halo3stats($gtfix, “kills”);
$lastplayed = “Last Played: “.halo3stats($gtfix, “lastplayed”);
$playersince = “Player Since: “.halo3stats($gtfix, “playersince”);

$rankimg = halo3stats($gtfix, “rankimg”);
$rankimg = imagecreatefromgif($rankimg);
$rankimg_x = imagesx($rankimg);
$rankimg_y = imagesy($rankimg);

imagettftext($im, 12, 0, 94, 51, $white, $font, $gtfix);
//imagettftext($im, 12, 0, 92, 49, $red, $font, $gtfix);
imagettftext($im, 12, 0, 93, 50, $black, $font, $gtfix);
imagettftext($im, 8, 0, 94, 65, $black, $verdana, $rank);
imagettftext($im, 8, 0, 93, 64, $red, $verdana, $rank);
imagettftext($im, 8, 0, 94, 76, $white, $verdana, $highlevel);
imagettftext($im, 8, 0, 93, 75, $black, $verdana, $highlevel);
imagettftext($im, 8, 0, 94, 87, $white, $verdana, $totalexp);
imagettftext($im, 8, 0, 93, 86, $black, $verdana, $totalexp);
imagettftext($im, 8, 0, 94, 98, $white, $verdana, $totalgames);
imagettftext($im, 8, 0, 93, 97, $black, $verdana, $totalgames);
imagettftext($im, 8, 0, 94, 109, $white, $verdana, $kills);
imagettftext($im, 8, 0, 93, 108, $black, $verdana, $kills);
imagettftext($im, 8, 0, 5, 15, $black, $verdana, $lastplayed);
imagettftext($im, 8, 0, 5, 26, $black, $verdana, $playersince);

imagecopymerge($im, $rankimg, 23, 33, 0, 0, $rankimg_x, $rankimg_y, 100);

imagepng($im);

imagedestroy($im);
?>[/code]

Is it because my font file is very large?

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @h3r0 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...