Jump to content

need help with images


iversonm

Recommended Posts

ok so i need some help obviously and i am not sure if what i want to do can be done without using flash which i might have to resort to if you guys cant figure it out. what i want to do is use php to layer certain images on a webpage. i have no idea where to even start with this and if you could help me i would be very greatful

Link to comment
Share on other sites

ok sorry for not being my descriptive. basically i want to create a scene if that makes any sense

this scene will change depending on the weather in your area pulling the data from a weather site(code is done and complete)

now what i need is a basic background image and then i want to layer images ontop of the main background image

the images the layer will be gif or png. basically if the weather outside is cloudy i want it to layer clouds onto it, or raining i want to layer the picture onto

does that help any

kind of a small example

so you would pull the data from yahoo weather

$condition = "cloudy";

so i would want to layer the cloud picture onto the main background picture

$condition ="snowing";

so i would want to layer on the picutre of snow

 

i dont know if that makes any sense at all

grr

let me know

Link to comment
Share on other sites

[This is not the best solution, but it is A SOLUTION]

If the "image sets" are standard per condition, you could break it down and do this:

 

Firstly, I'm assuming you will not have very many weather conditions...

-Day/Night background

  +Cold/Average/Hot temperature

  +Cloudly/Sunny/Rainy

  +Tornado/Hurricane/etc....

 

So you could do a series of CSS includes...

<?php
  if($timeOfDay == 'day')
  {
    echo '<link rel="stylesheet" type="text/css" href="day.css" />';
  }else{
    echo '<link rel="stylesheet" type="text/css" href="night.css" />';
  }//assume night if not day

//Then for more options of variation use a switch() statement
  switch($temperature)
    case 'cold':
      echo '<link rel="stylesheet" type="text/css" href="cold.css" />';
      break;

    case 'average':
      echo '<link rel="stylesheet" type="text/css" href="average.css" />';
      break;

    case 'hot':
      echo '<link rel="stylesheet" type="text/css" href="hot.css" />';
      break;
?>

 

etc etc, and just have each of the "group of options" have their images be in the same place, where really it's only replacing a background image.

Link to comment
Share on other sites

so then in the css file would i just set the background image for each file and say background attachment fixed and position absolute top here like this

 

body    {  color:#ffffff;

 

            background-image: url(http:my url to my image.com);

 

            background-attachment: fixed;

background-position:center;

 

            background-color:  #006600;

 

            font-size: 10pt;

 

            margin-left:5;

 

            font-family:Verdana,Arial;

 

            font-size: 10pt;

 

table align: center;

 

}

 

and then just change the url for each image location for each css file??

Link to comment
Share on other sites

Yes, you could make a "main.css" file that had everything ready to go, with divs that had no backgrounds so that they didn't show anything... then in your switch($case) statement / if - else statement include a day.css which could contain only

 

<link rel="stylesheet" type="text/css" href="main.css" />

if($timeOfDay == 'day') {

  include('day.css');

}else{

  include('night.css');

}

 

/* day.css */

div#main_bg {

  background-image:  url('imgs/day.gif');

}

 

 

/* night.css */

div#main_bg {

  background-image:  url('imgs/night.gif');

}

 

And do that with them.  That way it would overwrite whatever value you had to begin with.

Please remember that this solution is only viable if you don't have a whole lot of options to worry about, I'd say less than 10-15 in total.  If it were to get any more complicated, you should find another approach in order to save yourself a headache.

Link to comment
Share on other sites

ya tobad, haha i tried it and it was looking so promising but the problem is with doing this is it replacing the previous background image and i need them to layer, someone was saying i would use javascript or AJAX

anyone have any other ideas?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.