On Tuesday 30 October 2001 02:53 pm, you wrote:
> It is starting to make sense. I see the correlation between the manual
> example and the code you show. Surprisingly (and equally confusing) the
> book I have also uses a while loop with mysql_fetch_array to display a
> list.
You would use a while loop if/when you have multiple records to retrive.
>From your original code example, it seemed as though you would only have one
record. (though, for safety's sake, you should code a LIMIT into your sql
statement)
> This may be the problem as I now get "supplied argument not valid mysql
> result" on this line.
> $query = "select imglocation,height,width from img where
> imgname='$getimg'";
Two things to try:
1. Run that exact query on a mysql command line, substituting whatever
variable name you're trying to pass in the URL. Often times, I find that I
tihnk I have a PHP problem when, in fact, I screwed up my query syntax
somewhere.
2. Explicitly define $getimg as something you know to be a valid image. If
that works, then you know it isn't getting passed from the url properly.
> It looks like I might be able to use the GetImageSize function to do this
> same thing? maybe? All I am doing is getting the location (url) of an
> image and its height and width for an <img src= > statement..... maybe I
> am making this into a bigger job than necessary?? I think I have been
> working on it too long today and I need a long walk.....
Actually, yes you can.
$myImgSize = getImageSize('/unix/path/to/my/file.jpg'); should return the
image sizes in an array. You should then be able to do something like:
<img src="file.jpg" $myImgSize[3]>
Which should automatically include height/width parameters. (see this
function on the php site for more info -- also, that's untested, off-the-cuff
code I just wrote. Might not work perfectly. :)
--kurt
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]