dazzathedrummer Posted March 16, 2010 Share Posted March 16, 2010 Hi, I have an events page on my site (gigs) and we use an iPhone style graphic depicting a tear off calendar to illustrate the dates: - http://www.the-guards.org.uk/gigs.html I'm wondering if I can use a script to select and layer three images to build the final calendar image - ie, a background image, with a month name image and a number image for the day layered on top. At the moment we hard code the whole list in html and create a new image for each date that we have a booking for. I can then store 1 image for the background, 12 month images and 31 day number images and the date can be determined by using date functions on the date field in my database (which I can do - its just the graphic layering I'm unsure about). ? Quote Link to comment https://forums.phpfreaks.com/topic/195412-how-to-display-layered-jpegs-using-php/ Share on other sites More sharing options...
Wolphie Posted March 16, 2010 Share Posted March 16, 2010 I'm pretty sure you can achieve the layered effect using CSS. Quote Link to comment https://forums.phpfreaks.com/topic/195412-how-to-display-layered-jpegs-using-php/#findComment-1026867 Share on other sites More sharing options...
dazzathedrummer Posted March 16, 2010 Author Share Posted March 16, 2010 I'm pretty sure you can achieve the layered effect using CSS. ..do you mean by simply positioning the three images in the same place?? Quote Link to comment https://forums.phpfreaks.com/topic/195412-how-to-display-layered-jpegs-using-php/#findComment-1026915 Share on other sites More sharing options...
litebearer Posted March 16, 2010 Share Posted March 16, 2010 yep. See... http://www.html.net/tutorials/css/lesson15.asp Quote Link to comment https://forums.phpfreaks.com/topic/195412-how-to-display-layered-jpegs-using-php/#findComment-1026922 Share on other sites More sharing options...
dazzathedrummer Posted March 17, 2010 Author Share Posted March 17, 2010 yep. See... http://www.html.net/tutorials/css/lesson15.asp Thanks for that link, that works perfectly. My next question is, what am I doing wrong here: - I'm trying to set up an if statement to change the graphic image based on the results of a form. So, for example, if the form posts 'Month = 1' and 'Day = 1' then show the graphics relevent to January 1st. Im pretty sure i'll be able to figure out the file selection - I just cant seem to get any kind of if statement to work. This is what I created to try and echo it out: - www.the-guards.org.uk/private/calendartest does this: - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <title>Calendar test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css"> #background { position: absolute; left: 100px; top: 100px; z-index: 1; } #layer_1 { position: absolute; left: 100px; top: 100px; z-index: 2; } #layer_2 { position: absolute; left: 100px; top: 100px; z-index: 3; } #selectform { position: absolute; left: 100px; top: 200px; } </style> </head> <body> <h1>Show Calendar pic test</h1> <div id="background"> <img src="calpics/background.png" width="79" height="79" alt="Background"> </div> <div id="layer_1"> <img src="calpics/25.png"width="79" height="79" alt="layer1"> </div> <div id="layer_2"> <img src="calpics/mar.png"width="79" height="79" alt="layer2"> </div> <div id="selectform"> <form action="calposttest.php" method="post"> <select name="month" id="month"> <option selected="selected">1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> </select>Month <br> <select name="day" id="day"> <option selected="selected">1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option> <option>24</option> <option>25</option> <option>26</option> <option>27</option> <option>28</option> <option>29</option> <option>30</option> <option>31</option> </select>Day<br> <input type="submit" name="submit" value="submit"> </form> </div> </body> </html> and calposttest.php does this: - <?php if ($_POST["month"]=="1") { echo $_POST["month"]} else echo "something"; ?> All i'm trying to do at the moment is get the if statement to work so I can adapt it to echo the filenames of the different calendar images - once I get that going i'll then conect it to a db so the image is generated from a date field. Quote Link to comment https://forums.phpfreaks.com/topic/195412-how-to-display-layered-jpegs-using-php/#findComment-1027499 Share on other sites More sharing options...
PFMaBiSmAd Posted March 17, 2010 Share Posted March 17, 2010 Each of your <option> tags needs a value="..." attribute to tell it what value to submit when it is selected. Quote Link to comment https://forums.phpfreaks.com/topic/195412-how-to-display-layered-jpegs-using-php/#findComment-1027502 Share on other sites More sharing options...
dazzathedrummer Posted March 17, 2010 Author Share Posted March 17, 2010 Each of your <option> tags needs a value="..." attribute to tell it what value to submit when it is selected. ahh - its always something simple! thanks Quote Link to comment https://forums.phpfreaks.com/topic/195412-how-to-display-layered-jpegs-using-php/#findComment-1027504 Share on other sites More sharing options...
dazzathedrummer Posted March 17, 2010 Author Share Posted March 17, 2010 ok i've added the values to the option tags "<option value="2">2</option>" etc, but i'm still getting a blank page from the if statement - is my syntax correct? Quote Link to comment https://forums.phpfreaks.com/topic/195412-how-to-display-layered-jpegs-using-php/#findComment-1027512 Share on other sites More sharing options...
PFMaBiSmAd Posted March 17, 2010 Share Posted March 17, 2010 Your code is producing a fatal syntax error due to a missing semi-colon - Parse error: syntax error, unexpected '}', expecting ',' or ';' in ... ...\calposttest.php on line 4 You should be developing and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php will help you. You will save a TON of time. Quote Link to comment https://forums.phpfreaks.com/topic/195412-how-to-display-layered-jpegs-using-php/#findComment-1027520 Share on other sites More sharing options...
dazzathedrummer Posted March 17, 2010 Author Share Posted March 17, 2010 Your code is producing a fatal syntax error due to a missing semi-colon - Parse error: syntax error, unexpected '}', expecting ',' or ';' in ... ...\calposttest.php on line 4 You should be developing and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php will help you. You will save a TON of time. ah well thats highlighted a problem - my hosting provider upgraded their servers over the weekend - looks like I'm not getting error messages any more - i'll get in touch with them as I dont think I can access the php.ini myself. thanks, Darren Quote Link to comment https://forums.phpfreaks.com/topic/195412-how-to-display-layered-jpegs-using-php/#findComment-1027611 Share on other sites More sharing options...
PFMaBiSmAd Posted March 17, 2010 Share Posted March 17, 2010 You should be developing php code on a local development system. Constantly uploading code changes to a live server just to test what it does wastes a huge amount of development time. Code that is not fully tested often has security holes that would allow a hacker to exploit your live server. Also, a live server running with display_errors ON allows hackers to gain information about your account and server when they deliberately trigger errors. If necessary, you can set the error_reporting/display_errors settings in a local php.ini (when php is running as a CGI application) or in a .htaccess file (when php is running as an Apache Module.) Quote Link to comment https://forums.phpfreaks.com/topic/195412-how-to-display-layered-jpegs-using-php/#findComment-1027616 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.