[imp] GD picture in IMP (quotabar)

Krystian Filiks filiks at telesonique.com
Fri Sep 17 01:19:18 PDT 2004


Is there any other way to get a dynamic quotabar generated in imp?

-----Original Message-----
From: imp-bounces at lists.horde.org [mailto:imp-bounces at lists.horde.org]On
Behalf Of Jan Schneider
Sent: Donnerstag, 16. September 2004 19:15
To: imp at lists.horde.org
Subject: Re: [imp] GD picture in IMP (quotabar)


Zitat von Krystian Filiks <filiks at telesonique.com>:

> Hello,
>
> I'm trying to generate a quotabar using PHP+GD but fail upon putting the
> "header(Content-Type: image/png)" in to the header.inc file.
>
> Below find the relevant part of the header.inc template, as soon as I
> uncoment the // header("Content-type: image/png"); ?>
> I get an error that the page could not be loaded as it contains errors.
>
> If I keep the header("Content-type: image/png"); ?> commented then it
works
> fine just that the picture is displayed as text and not picture.
>
> I know that the header("Content-type: image/png"); directive must be
present
> if I want to display the generateg PNG picture.

No, because you call it in a PHP script that generates a HTML page.

>  Any ideas ho to make this work??
>
> <?php if (!$prefs->isLocked('filters')): ?>
>         <?php echo
Horde::link(Horde::applicationUrl("mailbox.php?actionID="
> . FILTER . "&page=$page&uniq=" . uniqid(rand())), sprintf("%s %s",
_("Apply
> Filters on"), $imp['label']), 'menuitem') . Horde::img('filters.gif',
> 'alt="' . sprintf("%s %s", _("Apply Filters on"),
> htmlspecialchars($imp['label'])) . '"') ?></a>&nbsp;
>
////////////////////////////////////////////////////////////////////////////
> ///////////
> <?php  $style_dir = '/var/www/html/progress/'; ?>
> <?php  $style = 'osx'; ?>
> <?php  $width = '250'; ?>
> <?php  $done = '45'; ?>
> <?php  $total = '100'; ?>
> <?php $bg       = @imagecreatefrompng($style_dir . $style . '-bg.png'); ?>
> <?php $fill     = @imagecreatefrompng($style_dir . $style . '-fill.png');
?>
> <?php $bg_cap   = @imagecreatefrompng($style_dir . $style .
'-bg-cap.png');
> ?>
> <?php $fill_cap = @imagecreatefrompng($style_dir . $style .
> '-fill-cap.png'); ?>
> <?php $fill_width = round((($width - imagesx($bg_cap)) * $done) / $total)
-
> imagesx($fill_cap); ?>
> <?php $image = imagecreatetruecolor($width, imagesy($bg)); ?>
> <?php imagecopy($image, $bg, 0, 0, 0, 0, imagesx($bg), $width -
> imagesx($bg_cap)); ?>
> <?php imagecopy($image, $bg_cap, $width - imagesx($bg_cap), 0, 0, 0,
> imagesx($bg_cap), imagesy($bg_cap)); ?>
> <?php imagecopy($image, $fill, 0, 0, 0, 0, $fill_width, imagesy($fill));
?>
> <?php imagecopy($image, $fill_cap, $fill_width, 0, 0, 0,
imagesx($fill_cap),
> imagesy($fill_cap)); ?>
> <?php // header("Content-type: image/png"); ?>
> <?php imagepng($image, "testquota.png"); ?>
> <?php imagedestroy($bg); ?>
> <?php imagedestroy($fill); ?>
> <?php imagedestroy($bg_cap); ?>
> <?php imagedestroy($fill_cap); ?>
> <?php imagedestroy($image); ?>
>
////////////////////////////////////////////////////////////////////////////
> ///////////////
>
> <?php endif; ?>......
> --
> IMP mailing list - Join the hunt: http://horde.org/bounties/#imp
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: imp-unsubscribe at lists.horde.org
>
>



Jan.

--
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/
-- 
IMP mailing list - Join the hunt: http://horde.org/bounties/#imp
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: imp-unsubscribe at lists.horde.org



More information about the imp mailing list