Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Background Fit Any Resolution


10 replies to this topic

#11 nolan

    Member [Level 3]

  • Kontributors
  • PipPipPipPipPipPip
  • 96 posts

Posted 11 December 2009 - 06:57 AM

Depending upon the amount of traffic your site gets, this could be a very bad idea and could upset your web host. By using GD to generate an image that's displayed every single time a user visits your page, you're putting a lot of unnecessary strain on the server's CPU. Imagine if you have a site that gets even 10,000 total page hits a month - that's 10,000 new graphics your website has to create on the fly.

As a better option, just use a very highly optimized, large background image that looks pleasant even when a portion of the image is cut off for smaller displays. (This is how most sites with large background images handle it.)

Best of luck!

View Postbjrn, on Jun 19 2005, 07:00 AM, said:

Background images are just like normal images in HTML documents, you can't set them to resize to whatever the user has.

You could use some PHP GD functions with some browser sniffing to resize the image before sending it to the client. What you'd have to do is this:
  • When the user comes to your page, check what resolution they are using.
  • Have a PHP function that resizes your background image to the resolution
  • Set the generated image as background image
  • Send all data to the user.





Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users