Thank everyone for suggestions.

I followed through on them but unsuccessfully. I looked for any mistake but
couldn't find it. I tried commenting out lines in chunks and one by one,
without any effect.

the problem stays the same, if the conditional statement is present then image
is not generated, otherwise the code works and is generating an image.
Also, the image is generating only in Netscape browzer?! Internet Explorer
does not display the image at all, never, with or without conditional.

Is their some trick i need to know to display images both in netscape and
iexplorer?

if smone would give it a shot i would be very thankfull! thnks in advance for
your help.

---file counter.php ---
<?php
        session_start();

        //get stats info
/*
        if ($_SERVER["QUERY_STRING"] != NULL ) {
                $from_page  = $_GET["fp"];
                $scr_width  = $_GET["wd"];
                $scr_height = $_GET["ht"];
                $color_palt = $_GET["cl"];
                $platform   = $_GET["pl"];
                $java       = $_GET["jv"];
                $taint      = $_GET["tn"];
        }//fi
*/
/*
                $this_page  = $_SERVER["PHP_SELF"];
                $address    = $_SERVER["REMOTE_ADDR"];
                $lang       = $_SERVER["HTTP_ACCEPT_LANGUAGE"];

                if (!isset($from_page)) $from_page = $_SERVER["HTTP_REFERER"];

*/
//              $bwzr_info  = $_SERVER["HTTP_USER_AGENT"];

        /*
                echo("previous page = $from_page <br>");
                echo("current page = $this_page <br>");
                echo("address = $address <br>");
                echo("screen width = $scr_width <br>");
                echo("screen height = $scr_height <br>");
                echo("color pallette = $color_palt <br>");
                echo("platform = $platform <br>");
                echo("language = $lang <br>");
                echo("browzer info = $bwzr_info <br>");
                echo("java enabled = $java <br>");
                echo("taint enabled = $taint <br>");
        */
        //---   LOG DATA INTO DATABASE  ---//
        // todo //

        //this is the begining of troublesome conditional statment
        if ( false ) {
                //echo("we here");
                //$image = ImageCreate(1,1);
                //$navyblue = ImageColorAllocate($image, 0, 0, 0);
                //ImageFilledRectangle($image, 0, 0, 1, 1, $navyblue);
        } esle {

                $web_uniqe_kount = sprintf("%07d",
$_SESSION['web_uniqe_count']);
                $web_total_kount = sprintf("%07d",
$_SESSION['web_total_count']);
                $web_print_kount = sprintf("%07d",
$_SESSION['web_print_count']);

                $office_uniqe_kount = sprintf("%07d",
$_SESSION['office_uniqe_count']);
                $office_total_kount = sprintf("%07d",
$_SESSION['office_total_count']);
                $office_print_kount = sprintf("%07d",
$_SESSION['office_print_count']);

                $uniqe_str = "Uniqe";
                $total_str = "Total";
                $print_str = "Print";

                $web_head = "Web";
                $office_head = "Office";

                $header_length = 6;
                $column_length = 9;

                $spacer = 1;

                $font_size = 1;
                $charHeight = ImageFontHeight($font_size);
                $charWidth = ImageFontWidth($font_size);

                $head_cell_Width = ($charWidth * $header_length) + (2 *
$spacer);
                $numb_cell_Width = ($charWidth * $column_length) + (2 *
$spacer);
                $cell_Height = $charHeight + (4 * $spacer);

                $row_Width = $head_cell_Width + (2 * $numb_cell_Width);
                $row_Height = $cell_Height;

                $column_Width = $numb_cell_Width;
                $column_Height = $cell_Height * 4;

                $horizontalMargin = 1;
                $verticalMargin = 1;

                $image_Width = $row_Width + (2 * horizontalMargin);
                $image_Height = $column_Height + (2 * verticalMargin);

                //create blank image template with specified dimmentions
                $image = ImageCreate($image_Width, $image_Height);

                //initiate color pallete to be used
                $black = ImageColorAllocate($image, 0, 0, 0);
                $white = ImageColorAllocate($image, 255, 255, 255);
                $red   = ImageColorAllocate($image, 255, 0, 0);

                //fill image background with black color
                ImageFilledRectangle($image, 0, 0, $imageWidth, $imageHeight,
$black);

                //set line style for the image
                $line_style = array($black, $black, $black, $black, $black,
$red, $red, $red);
                ImageSetStyle($image, $line_style);


                //---   DRAW THE IMAGE  ---//

                //draw the table
                $drawCoordinateX = $horizontalMargin;
                $drawCoordinateY = $verticalMargin + $cell_Height;
                ImageLine($image, $drawCoordinateX, $drawCoordinateY,
$image_Width-$horizontalMargin, $drawCoordinateY, IMG_COLOR_STYLED);
                $drawCoordinateY += $cell_Height;
                //ImageLine($image, $drawCoordinateX, $drawCoordinateY,
$image_Width-$horizontalMargin, $drawCoordinateY, IMG_COLOR_STYLED);
                $drawCoordinateY += $cell_Height;
                ImageLine($image, $drawCoordinateX, $drawCoordinateY,
$image_Width-$horizontalMargin, $drawCoordinateY, IMG_COLOR_STYLED);

                $drawCoordinateY = $verticalMargin;
                $drawCoordinateX = $horizontalMargin + $head_cell_Width;
                ImageLine($image, $drawCoordinateX, $drawCoordinateY,
$drawCoordinateX, $image_Height-$verticalMargin, IMG_COLOR_STYLED);
                $drawCoordinateX += $numb_cell_Width;
                ImageLine($image, $drawCoordinateX, $drawCoordinateY,
$drawCoordinateX, $image_Height-$verticalMargin, IMG_COLOR_STYLED);

                ImageColorTransparent($image, $red);

                //draw column headers
                $drawCoordinateX = $horizontalMargin + $head_cell_Width +
$spacer;
                $drawCoordinateY = $verticalMargin + (2*$spacer);
                ImageString($image, $font_size,
$drawCoordinateX+$numb_cell_Width-$spacer-$spacer-($charWidth*strlen($web_head)),
$drawCoordinateY, $web_head, $white);
                $drawCoordinateX += $numb_cell_Width;
                ImageString($image, $font_size,
$drawCoordinateX+$numb_cell_Width-$spacer-$spacer-($charWidth*strlen($office_head)),
$drawCoordinateY, $office_head, $white);

                //draw row headers
                $drawCoordinateX = $horizontalMargin + $spacer;
                $drawCoordinateY = $verticalMargin + $cell_Height +
(2*$spacer);
                ImageString($image, $font_size, $drawCoordinateX,
$drawCoordinateY, $uniqe_str, $white);
                $drawCoordinateY += $cell_Height;
                ImageString($image, $font_size, $drawCoordinateX,
$drawCoordinateY, $total_str, $white);
                $drawCoordinateY += $cell_Height;
                ImageString($image, $font_size, $drawCoordinateX,
$drawCoordinateY, $print_str, $white);


                //draw the web stats
                $drawCoordinateX = $horizontalMargin + $head_cell_Width +
$spacer;
                $drawCoordinateY = $verticalMargin + $cell_Height +
(2*$spacer);
                        $textCoordinateX = $drawCoordinateX + $numb_cell_Width
- (2 * $spacer) - ($charWidth*strlen($web_uniqe_kount));
                ImageString($image, $font_size, $textCoordinateX,
$drawCoordinateY, $web_uniqe_kount, $white);

                $drawCoordinateY += $cell_Height;
                        $textCoordinateX = $drawCoordinateX + $numb_cell_Width
- (2 * $spacer) - ($charWidth*strlen($web_total_kount));
                ImageString($image, $font_size, $textCoordinateX,
$drawCoordinateY, $web_total_kount, $white);

                $drawCoordinateY += $cell_Height;
                        $textCoordinateX = $drawCoordinateX + $numb_cell_Width
- (2 * $spacer) - ($charWidth*strlen($web_print_kount));
                ImageString($image, $font_size, $textCoordinateX,
$drawCoordinateY, $web_print_kount, $white);


                //draw the office stats
                $drawCoordinateX = $horizontalMargin + $head_cell_Width +
$numb_cell_Width + $spacer;
                $drawCoordinateY = $verticalMargin + $cell_Height +
(2*$spacer);
                        $textCoordinateX = $drawCoordinateX + $numb_cell_Width
- (2 * $spacer) - ($charWidth*strlen($office_uniqe_kount));
                ImageString($image, $fonr_size, $textCoordinateX,
$drawCoordinateY, $office_uniqe_kount, $white);

                $drawCoordinateY += $cell_Height;
                        $textCoordinateX = $drawCoordinateX + $numb_cell_Width
- (2 * $spacer) - ($charWidth*strlen($office_total_kount));
                ImageString($image, $fonr_size, $textCoordinateX,
$drawCoordinateY, $office_total_kount, $white);

                $drawCoordinateY += $cell_Height;
                        $textCoordinateX = $drawCoordinateX + $numb_cell_Width
- (2 * $spacer) - ($charWidth*strlen($office_print_kount));
                ImageString($image, $fonr_size, $textCoordinateX,
$drawCoordinateY, $office_print_kount, $white);

        }//end of troublesome conditional stament

        //interlace the image
        //ImageInterlace($image, 1);

        //set background blak color to be transparent - NOT SUPPORTED on JPEG
        //ImageColorTransparent($image, $black);

        //header("Content-type: image/jpeg");
        //imagejpeg($image, "", 100);

        header("Content-Type: image/png");
        //header("Content-Disposition: inline; filename=counter.php");
        ImagePng($image);

        //have to destroy the image, otherwise will starve web-server of
memory
        ImageDestroy($image);

?>
--- end of counter.php file ---


Richard Lynch wrote:

> >I have a problem with conditional image generation. If I generate an
> >image without any conditional statments, then everything works fine. But
> >if i introduce conditional statment, then no image is generated in
> >either case of the condition.
> >
> >Has anyone dealt with this dilema before?
>
> There's nothing "wrong" with the conditional idea, but you've just got a
> mistake somewhere in your code.
>
> Surf to the image generation URL (the stuff you put after SRC= in your IMG
> tag) and see what error messages you've got.
>
> --
> Like Music?  http://l-i-e.com/artists.htm
> I'm looking for a PRO QUALITY two-input sound card supported by Linux (any
> major distro).  Need to record live events (mixed already) to stereo
> CD-quality.  Soundcard Recommendations?
> Software to handle the recording? Don't need fancy mixer stuff.  Zero (0)
> post-production time.  Just raw PCM/WAV/AIFF 16+ bit, 44.1KHz, Stereo
> audio-to-disk.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to