Am 03.09.2003 um 1:34 Uhr schrieb Chris W. Parker:
> Another option would be to tweak the logic so that it's not so bloated.

Am 03.09.03 um 01:38 Uhr schrieb John W. Holmes:
> This really begs the question of WTF you have a 10,000+ line file that
> you only need a couple lines from... seems like your logic is screwy.

every time my script is executed a line is added to a given image.
right now every image is saved as new file because it needs to remain
accessible in it's current state. at the moment there are only 200+
entries and the present image size is about 20 kb. but if i someday get
10'000 hits this would mean 200 mb of used disc space. (see
www.ipdraw.org)

therefore i thought it would be a more adequate way to write each
imageline() line into one text file and then as an archived entry is
requested generate the image by only including line 1 - $request_no.

since i already save a file containing some vars for each visitor maybe
something like this could be a possible solution:

$i = 1;
while ($i <= $request_no) {
     $filename = "entry-" . $i . ".php";
     include($filename); // contains $image, $ip and $color
     imageline($image, $ip[0], $ip[1], $ip[2], $ip[3], $color);
     $i++;
}

but as $request_no may potentially be 10'000 or higher i thought
including that much files could cause an unneeded slow down of the
whole thing.

maybe you know of a less screwy-logic method to do this (in a fast way).

thanks for your help!
philipp


/cut/
> image.php
> <?
> header("Content-type: image/png");
> $image = imagecreate(510, 510);
> $color = ImageColorAllocate($image, 0, 0, 0);
>
> include("database.php");
>
> ImagePNG($image, '', 95);
> imagedestroy($image);
> ?>
>
> database.php
> <?
> imageline($image, 420, 468, 308, 372, $color);
> imageline($image, 132, 154, 146, 144, $color);
> imageline($image, 420, 318, 440, 180, $color);
> imageline($image, 418, 474, 476, 320, $color);
> imageline($image, 418, 474, 476, 324, $color);
> [...]
> ?>

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

Reply via email to