Jump to content


Photo

resizing a browser window in PHP


  • Please log in to reply
2 replies to this topic

#1 spikasso

spikasso
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 04 April 2006 - 11:57 AM

Hi,
i am wondering if a function or a script similar to the Java ''ResizeTo'' function exist in PHP?
I have a slideshow script and i would like the browser window to resize to the next (or previous) picture when people click on the next or previous links.
I have looked on the web and many PHP help sites, but cannot find anything.
Worse come to worse and if this function does not exits, or there is no way to resize a browser window with php, can i use the variables from my php script in the java command? if so, how?

thanks in advance!

#2 DrDre

DrDre
  • Members
  • PipPipPip
  • Advanced Member
  • 35 posts

Posted 04 April 2006 - 12:23 PM

Cannot do that. PHP Is a server side language. The browser knows absolutely nothing about the php going on.

PHP Just shoots text data back at the browser.

To do this just simply do some javascript to call a function onload
that will get the size of the current image in the image ID and resize to that

similiar to
<script>
function ResizeMe(imgid) {
// Im not sure of the proper image size code for JS, please check this!!
//Also check all function names and casing as im prolly typing it wrong!
 width=document.getElementById(imgid).width + 50;
 height=document.getElementById(imgid).height + 50;

window.resizeTo(width,height);
}
</script>
<body onload="ResizeMe('myimage')">
<img id='myimage' src='pictures.php?picture=1'>
<a href='next.php'>Next Picture</a>

Hope you understand.

Just remember, HTML,CSS,JS, etc all run on the client side
PHP,ASP,etc run on the server side, and send data to the client.
[a href="http://forums.fanetworks.net" target="_blank"][/a]
» faNetworks Webmaster. [[a href="http://fanetworks.net" target="_blank"]fanetworks.net[/a]]
» faSoftware Developer [[a href="http://software.fanetworks.net" target="_blank"]software.fanetworks.net[/a]]
» faForums - php Resource + more [[a href="http://forums.fanetworks.net" target="_blank"]forums.fanetworks.net[/a]]
» Experienced php Coder - Ill help anyone I can if I have time ;)

#3 spikasso

spikasso
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 04 April 2006 - 12:33 PM

ahh, ok, i was hoping not to have to mix java and PHP.

i will have alook at the script and add it to the slideshow,

thanks a lot!!!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users