Guest User

Untitled

a guest
Jul 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. <?php
  2. $imglist="imglist.txt";
  3. $imgarray=file($imglist, FILE_SKIP_EMPTY_LINES);
  4. $imgnumber=rand(0,count($imgarray)-1);?>
  5. <script type="text/javascript" src="jquery-1.7.2.min.js" />
  6. <script type="text/javascript">
  7. var viewportwidth;
  8. var viewportheight;
  9. // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
  10. if (typeof window.innerWidth != 'undefined')
  11. {
  12. viewportwidth = window.innerWidth,
  13. viewportheight = window.innerHeight
  14. }
  15. // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
  16. else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
  17. {
  18. viewportwidth = document.documentElement.clientWidth,
  19. viewportheight = document.documentElement.clientHeight
  20. }
  21. // older versions of IE
  22. else
  23. {
  24. viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
  25. viewportheight = document.getElementsByTagName('body')[0].clientHeight
  26. }
  27. </script>
  28.  
  29. <body style="margin:0px">
  30.  
  31. <a target= _blank href="<? echo($imgarray[$imgnumber])?>"><img id ="random" src="<? echo($imgarray[$imgnumber])? max-width=<? echo($viewportwidth)?> max-height=<? echo($viewportheight)?>>" /></a>
  32.  
  33. <script type="text/javascript">
  34. $('#random').attr('height', viewportheight);
  35. </script>
  36. </body>
Add Comment
Please, Sign In to add comment