Page 1 of 1

image height and width

Posted: Sat Jan 22, 2005 10:30 pm
by bst82551
i am adding some small modifications to a php image gallery script and seem to be having problems with the height and width attributes of the pop-up window.

php source:

Code: Select all

<html>
<head>
<title><?php

echo $_GET&#1111;'img'];
$img = $_GET&#1111;'img'];
$h = $_GET&#1111;'h'];
$w = $_GET&#1111;'w'];

?>
</title>
<link href="http://bst82551.ath.cx:8181/scroll.css" rel="stylesheet" type="text/css">
</head>
<body>
<a href="javascript:window.close()">
<img src="<?php

echo $img;

?>" height=<?php

echo $h;

?> width=<?php

echo $w;

?>>
</a>
</body>
</html>
HTML output:

Code: Select all

<html>
<head>
<title>image.jpg</title>
<link href="http://bst82551.ath.cx:8181/scroll.css" rel="stylesheet" type="text/css">
</head>
<body>
<a href="javascript:window.close()">
<img src="image.jpg" height=1021 width=1492>
</a>
</body>
</html>
my problem is- even though the html source is being put out in the correct manner, the height and the width just don't seem to want to change to the height and width specified. Why? :-(.

Brian

Posted: Sat Jan 22, 2005 10:40 pm
by mrmachoman

Code: Select all

$h = imagesy($img);
$w = imagesx($img);
Hopefull this helps.

Posted: Sat Jan 22, 2005 10:42 pm
by feyd
this code does not create the pop-up, nor does it manipulate it's window object..

Posted: Sat Jan 22, 2005 11:02 pm
by bst82551
nothing was wrong- sorry, i just was doing something i didn't realize i was doing. and- i didn't mean for the code to produce the pop up window... i meant that the code was meant to be shown when the pop up came up. Like the popup IS the code. Anyway, yeah- no problems with the code... i just thought a little too hard about something that really doesn't require any thinking at all. Sorry.

Brian

Posted: Sat Jan 22, 2005 11:10 pm
by feyd
the small island nation of feyd rejoices in your triumph over your brain fart.

Posted: Sun Jan 23, 2005 5:23 am
by onion2k
mrmachoman wrote:

Code: Select all

$h = imagesy($img);
$w = imagesx($img);
Hopefull this helps.
It won't. In order to use imagesx() and imagesy() you need to load the image as a GD resource. Which you failed to point out.

Use getimagesize() instead if you're only after the dimensions.