/    Sign up×
Community /Pin to ProfileBookmark

GD Library create multiple images

hi,
i am using GD Library and want to create multiple images
But this code creat only 1 image ?
My code is

[code=php]for($i=0;$i<3;$i++){

$values = array(
‘event_name’ => “Disney On Ice presents DARE TO DREAM”,
‘ticket_number’ => “0000008830”,
‘event_date’ => date(‘Y-m-d’),
‘time’ => date(‘H:i’),
‘recipi’ => “John Smith”,
‘state’ => “Amway Center”,
‘address’ => “400 W Church Street”,
‘city’ => “Orlando FL”,
‘zip’ => “32805”,
‘expire_date’ => “Friday, Sep. 30, 2011”,
‘event_image’ => “ss”,
‘ticket_type’ => “This is the ticket type”,
‘ticket_price’ => “$25.00”
);

$event_name = $values[‘event_name’];

$width = 800;
$height = 436;

$arialbd = “arialbd.ttf”;
$arial = “arial.ttf”;

$im = imagecreatefrompng(“blankticket.png”);

$black = imagecolorallocate($im, 0, 0, 0);
$yellow = imagecolorallocate($im, 238, 175, 12);
$blue = imagecolorallocate($im, 1, 100, 165);

imagettftext($im, 10, 0, 583, 68, $black, $arialbd, $ticket_number);

header (“Content-type: image/png”);
imagepng($im, ‘ticket.png’);
imagepng($im);

header(‘Content-Type: image/png’);
header(‘Content-Disposition: attachment;filename=”ticket.png”‘);
$fp=fopen(‘temp_ticket.png’,’r’);
fpassthru($fp);
fclose($fp);

}[/code]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@chris0Oct 01.2011 — you can NOT send multiple images per php file, only ONE SINGLE image

when you do this

header ("Content-type: image/png");

header('Content-Type: image/png');

header('Content-Disposition: attachment;filename="ticket.png"');

those are headers for a single image per file.
×

Success!

Help @aadi 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.28,
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,
)...