...

View Full Version : Request - image resize depending on client display settings



wvisscher
06-22-2004, 03:28 PM
Hi to you all,
I'm new to this forum and i don't know if this is discussed before but I have a request for a script.

Is it possible to collect the client display settings (width and height) at full screen and send this to the server. A PHP script then must process these values to resize an image acording to those values (serverside). The Javascript must then show the resized image full screen on the client computer.

The PHP script i use is:

<?php

function imageresize($width, $height, $target) {


if ($width > $height) {
$percentage = ($target / $width);
} else {
$percentage = ($target / $height);
}

//gets the new value and applies the percentage, then rounds the value
$width = round($width * $percentage);
$height = round($height * $percentage);
return "width=\"$width\" height=\"$height\"";
}


//get the image size of the picture and load it into an array
$mysock = getimagesize("playa_del_ingles_big.jpg");

?>

<img src="playa_del_ingles_big.jpg" <?php print (imageresize($mysock[0], $mysock[1], 150)); ?>>

How can i do that and pass the values to the script?

Thanks in advance,

Wietze

Vladdy
06-22-2004, 03:44 PM
What does client screen size have to do with the size of the browser clent window???

wvisscher
06-22-2004, 03:54 PM
Hi,


What does client screen size have to do with the size of the browser clent window???

I have a big collection of large images (3000x2000 pixels) on my server and want them to be shown at the client computer in a way they don't have to scroll. The (resized) image must be fit in the client (maximized) browser window.

Wietze

jbot
06-22-2004, 03:58 PM
you want a script to detect screen size then. this would then populate some hidden fields. when the user clicks a link to the page with the images, you append these values to the query string. then in you PHP app, you use $HTTP_GET_VARS to pull them out. having done this, you can code your app to resize the images accordingly before displaying them to the user.

wvisscher
06-22-2004, 04:03 PM
Hi Jbot,

Can you please post an example? This would be very helpful to me.

Wietze

Vladdy
06-22-2004, 04:03 PM
Hi,



I have a big collection of large images (3000x2000 pixels) on my server and want them to be shown at the client computer in a way they don't have to scroll. The (resized) image must be fit in the client (maximized) browser window.

Wietze
How do you know that the client window is maximized?

wvisscher
06-22-2004, 04:26 PM
Hi Vladdy,


How do you know that the client window is maximized?

I don't know, but I think there must be a way determine the maximum available size (current display settings of the client). So I can open a new maximized window from JS.

Wietze

Vladdy
06-22-2004, 04:39 PM
Hi Vladdy,



I don't know, but I think there must be a way determine the maximum available size (current display settings of the client). So I can open a new maximized window from JS.

Wietze
First, how do you know that JS is available.
Second, even if it is, real browsers won't let you manipulate window size (plus pop-up blockers won't let you open new windows)

If you want to make it user friendly, initialy load small thumbnails. Next to each thumbnail have a list of links to images of preset resolutions:


|------------------|
| | 640x480
| Thumbnail | 800x600
| | 1200x800
|------------------|



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum