Jump to content


Photo

**SOLVED** Get screen resolution with php?


  • Please log in to reply
3 replies to this topic

#1 jcoones

jcoones
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 27 May 2006 - 11:34 PM

Anyone know how to determine a browser's screen resolution with php or can it only be done with Javascript?

I want to set up an include file with some code that would say something like:

if(screen resolution is 800x600){
echo "<img src=Images/thisImage.gif>";
}
else {
echo "<img src=Images/anotherImage.gif>";
}


Thanks


Please ignore this post. I figured it out!

Thanks anyway. [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]

#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 27 May 2006 - 11:59 PM

I don't think PHP can do this, but you can use Javascript instead.

[a href=\"http://www.pageresource.com/jscript/jscreen.htm\" target=\"_blank\"]http://www.pageresource.com/jscript/jscreen.htm[/a]
~ D Kuang

#3 Allen4172

Allen4172
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 28 May 2006 - 06:55 PM

[!--quoteo(post=377681:date=May 27 2006, 07:34 PM:name=jcoones)--][div class=\'quotetop\']QUOTE(jcoones @ May 27 2006, 07:34 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]

Please ignore this post. I figured it out!

[/quote]

Did you figure out how to do it in PHP? If so would you please post the solution so others may see.

#4 jcoones

jcoones
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 31 May 2006 - 08:46 PM

Not really! What I wanted to do was to have one image that would be displayed on every page of my site if a user's browser was set to 800x600 and another image that would be displayed if a user's browser was set to 1028x768.

What I ended up doing was creating a php include file that had a small Javascript in it and I included that file on each of my site pages.

A bit of a kludge but it works fine. [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /]







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users