Last active
          August 29, 2015 13:56 
        
      - 
      
- 
        Save porty/9064813 to your computer and use it in GitHub Desktop. 
    Show me an image plz
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <html> | |
| <head> | |
| <style> | |
| body { | |
| background-size: contain; | |
| background-repeat: no-repeat; | |
| background-position: center; | |
| } | |
| </style> | |
| <script> | |
| <!-- | |
| function getQueryParams(qs) { | |
| qs = qs.split("+").join(" "); | |
| var params = {} | |
| var tokens = null; | |
| var re = /[?&]?([^=]+)=([^&]*)/g; | |
| while (tokens = re.exec(qs)) { | |
| params[decodeURIComponent(tokens[1])] | |
| = decodeURIComponent(tokens[2]); | |
| } | |
| return params; | |
| } | |
| function setPicture() { | |
| var params = getQueryParams(document.location.search); | |
| var img = params.img; | |
| var color = params.color || "black"; | |
| var size = params.size || "contain"; | |
| document.body.style["background-image"] = "url(" + img + ")"; | |
| document.body.style["background-color"] = color; | |
| document.body.style["background-size"] = size; | |
| } | |
| //--> | |
| </script> | |
| </head> | |
| <body onload="setPicture();"> | |
| </body> | |
| </html> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment