image height and width

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bst82551
Forum Newbie
Posts: 15
Joined: Wed Dec 29, 2004 12:25 pm
Location: Huntsville, Texas

image height and width

Post 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
mrmachoman
Forum Newbie
Posts: 5
Joined: Sat Jan 22, 2005 6:36 pm

Post by mrmachoman »

Code: Select all

$h = imagesy($img);
$w = imagesx($img);
Hopefull this helps.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

this code does not create the pop-up, nor does it manipulate it's window object..
bst82551
Forum Newbie
Posts: 15
Joined: Wed Dec 29, 2004 12:25 pm
Location: Huntsville, Texas

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

the small island nation of feyd rejoices in your triumph over your brain fart.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post 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.
Post Reply