Conor,

This works for me I even tried 6000 pixels and did not fill it. The
stripping of tags doesnt work so well but im sure youve already got
that covered so just replace it with your code.

<?php
$myfile = "";

$fh = fopen ("$myfile", "r");
while ($buffer = fgets ($fh, 4096))
{
  $out[$i++] .= rtrim (ereg_replace ("<([^>]|\n)*>", "", $buffer));
}
fclose ($fh);

header ("Content-type: image/png");
$im = ImageCreate (640, 3000);
$background = ImageColorAllocate ($im, 255, 255, 255);
$foreground = ImageColorAllocate ($im, 0, 0, 0);

$index = count ($out);
for ($i=0; $i <= $index; $i++)
{
  $l += 10;
  ImageString ($im, 1, 5, $l,  $out[$i], $foreground);
}
ImagePng ($im);
?>

Hope this helps,

Stewart

--- Conor McTernan <[EMAIL PROTECTED]> wrote:
> two in two days, i must look like a real retard.
> 
> anyway, i'm having another problem with GD now, it seems that when i
> create my image, if
> i specify too many pixels i.e. imagecreate(600, 2290) it will not
> create the image, just
> a blank file
> 
> it's sort of hard to explain, but i'll try. 
> 
> i am currently reading in a html file, which i want to display as an
> image. I read in my
> HTML and strip it of all HTML tags, this is stored as a varaible. i
> now explode this
> string using every occurence of a new line (\n), into an array, this
> gives me an array
> of lines. I now want to format the text a little bit, because I dont
> want my lines to be
> too long, so i word wrap it to 40 cols, followed by a rtrim, just to
> remove any chars 
> that will appear in the image that i dont want. 
> 
> i then pass this array into my imageMake method. i create my image,
> using imagecreate,
> now, for my x value, i set it to be 500, and i set my y value to be
> 1963(i'll explain
> why in a minute). i then execute a for loop, which runs through each
> of the elements of
> the array(each line of text) and runs the GD ImageString function,
> this will take an
> incrementing value, making sure that each new line is below each
> other. 
> 
> when the for loop is completed, i call ImagePNG and then
> ImageDestroy. I suppose I
> should mention that I am creating a seperate image, and not
> displaying it imediattly.
> 
> anyway, so long as I keep the Y value of the imagecreate function
> below 1963 the image
> will be created, but not all of the text is dispayed, since there
> seems to be more
> lines of text than area displayed.. if it is larger than that, all i
> get is a blank
> image, and if i try opening it in an image viewer i get an error. 
> 
> i have a feeling that it is someway related to the size of my text
> set, i.e. it is
> currently 216 lines long(after i perform the word wrap on it). also,
> if I run the exact
> same code on the same text formatted differntly (HTML removed,
> wordwrapped all done in
> pre-processing) it seems that I am able to increase the Y value in
> the imagecreate
> function, but, I still cannot raise it so far as to be able to
> include all of the text. 
> 
> this seems very strange, and I was wondering if anyone else has
> encountered this problem
> before. 
> 
> i'm not sure if i've made myself too clear here, if you have any
> questions, fire away.
> 
> sorry for the long post
> 
> Conor
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!
http://greetings.yahoo.com

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

Reply via email to