Jump to content
xisto Community
Sign in to follow this  

Php Picture Background.

Recommended Posts

Placing a background image is not just PHP programming. This is a basic HTML coding or CSS coding.

Since your site is open source os commerce, look for in stylesheet.css related to body or background.

Place CSS code

body {background-image: url('image/location/name.ext');}

There are other settings that background-image use such as repeat or no repeat, background default color, margin etc. Look up this property and apply them correctly.

Also, since your site uses table, be sure to attribute table correctly. Otherwise, you'll have white blanks where table is shown.

Share this post

Link to post
Share on other sites

Just to expand on this...PHP is a backend language. It never sees the light of day, all it does is spit out other languages and HTML is the one used to create webpages (usually) so you will also need to learn HTML and some CSS in order to be able to create webpages with PHP.Also beware that using a large image for a background will make your website slow to load, it is advisable to only use a tileable image (IE one that you can copy and paste next to itself and not notice the joins) or even better to use coloured areas with carefully placed images arranged using CSS as image backgrounds generally look old and tacky :)

Share this post

Link to post
Share on other sites

Try the below script to add Background Image Using PHP

$random = array(
'URL to image',
'URL to image',
'URL to image'
header("Location: $random[0]");

ok, i only used 3 images but you can add more
just that last one where you put the image URL
cannot have a comma at the end because its ending the list

once you have inputed the URL's upload
*note all images do not have to be same size unless your putting them into the second code i give

once you have them uploaded just input the URL to the PHP script into the code given below

*note the code below is just the easiest and most common code people will use
there are other ways to use this code
such as the CSS Rollover Script i contributed a while back
or to place it in a regular image would be more difficult
you would have to make each image the same dimensions
and place the php script as a background image such as:

<div style="background-image:url('URL TO PHP SCRIPT'); width:XX; height:XX; overflow:hidden; visibility:visible">

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.