Re: [PHP] another GD question

2002-02-26 Thread Stewart Gateley

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.

]|\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




Re: [PHP] is there an "in" qualifier in PHP?

2002-02-26 Thread Stewart Gateley

I'm tired :)

-- Stewart

--- J Smith <[EMAIL PROTECTED]> wrote:
> 
> That will result in a parse error. I think you mean
> 
> if (in_array($row['id'], $selected_users)) { /* execute */ }
> 
> J
> 
> 
> 
> Stewart G. wrote:
> 
> > if ($row['id'] in_array ($selected_users)) { // execute }
> > 
> > =S.
> > 
> 
> 
> -- 
> 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




Re: [PHP] Valid characters for filenames. List available?

2002-02-26 Thread Stewart Gateley

Im not the best at writing regex, but this could be represented as

$filename = ereg_replace ("[^a-zA-Z0-9.-_]", "_", $filename);

Someone correct me if I am wrong (this is what im using to rename
uploaded files, seems to work).

-- Stewart

--- Erik Price <[EMAIL PROTECTED]> wrote:
> 
> On Tuesday, February 26, 2002, at 01:34  PM, Chris Hewitt wrote:
> 
> >> I am wondering if there is anywhere a list of characters which are
> not
> >> allowed in a unix file name.
> >>
> >> I gues somethin like ' or \ is not allowed, but what else?
> > My old "Teach Yourself Unix" book makes it:
> > !@#$%^&()[]'"?\|;<>`+- space tab backspace
> > though it says technically some could be used but might cause
> problems.
> 
> As a general rule, filenames should only ever be composed of the 
> following characters:
> 
> letters (A-Z and a-z)
> numbers (0-9)
> underscorese (_)
> hyphens (-)
> dots (.)
> 
> Surely there will be some disagreement with this, but it's our policy
> 
> where I work to make certain that filenames can only be composed of 
> these characters.  I even have the CMS I'm designing set so that 
> nonconformant filenames are not allowed, with a message explaining
> why.  
> The characters to be especially careful to avoid are:
> 
> forward-slashes (/)
> backslashes (\)
> quotes (')
> doublequotes (")
> colons (:)
> spaces ( )
> 
> The slashes are usually filesystem hierarchic delimiters on Windows
> and 
> Unix, as is the colon on pre-OS 9 Mac filesystems.  Quotes and 
> doublequotes are usually used to escape command line strings, so they
> 
> can cause confusion (note that this includes singlequotes used as 
> apostrophes, like "John'spicture.jpg").  It's not that you can't use 
> quotes, but it forces the person manipulating them to be very careful
> 
> about how they refer to the filename.  Likewise, spaces need to be 
> escaped, so they're a bad idea.
> 
> This is just my opinion, but I'm sure others will agree.
> 
> Erik
> 
> 
> 
> 
> 
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
> 
> 
> -- 
> 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




Re: [PHP] is_uploaded_file() emulation?

2002-02-26 Thread Stewart Gateley

$owner = fileowner ($file);

returns a string containing the owner or false. see
http://www.php.net/manual/en/ref.filesystem.php

-- Stewart
 
--- Bogdan Stancescu <[EMAIL PROTECTED]> wrote:
> Hello all!
> 
> How do I find out if a file was actually uploaded /without/ using 
> is_uploaded_file()?
> 
> My first though is that I should use fileowner() on the file and see
> if 
> it's the same as the user who runs PHP (Apache) - but how do I find
> that 
> out? I don't want to use exec("id -u") either because the syntax may
> be 
> different for distinct systems and I'd like to avoid system calls if 
> possible.
> 
> I'm open to any suggestions to solve the original problem - not 
> necessarily using UID's.
> 
> Thanks!
> 
> Bogdan
> 
> 
> 
> -- 
> 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