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
https://forums.phpfreaks.com/topic/109840-need-help-with-images/
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

[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.

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??

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.