[PHP] help in php script
I have a following PHP file TimeRotateImage.php which prints an image ?php $curr_time = (localtime()); if ($curr_time[2] = 6 and $curr_time[2] = 17) { PRINT IMAGE_1; } else { PRINT IMAGE_2; } ? I want to use this script in another file to display the image. the tag should be img src=TimeRotateImage.php But i am not getting any output if i follow the above procedure. Can you tell me how to do it? I have to have the script TimeRotateImage.php which calculates which image to print accoring to local time and i want to embed the file name in html tag to print it on screen. thanks in advance. deepak -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help in php script
Deepak Dhake wrote: But i am not getting any output if i follow the above procedure. Can you tell me how to do it? I have to have the script TimeRotateImage.php which calculates which image to print accoring to local time and i want to embed the file name in html tag to print it on screen. It's not clear what your PRINT macros are doing. Maybe you forgot to send the content-type-header? Or maybe there is a script error which is not displayed when you call the page inside a image tag. Call the script directly in your browser to see what's going on. If it outputs binary data then everything is working but you forgot the content-type header. -- Bye, K http://www.ailis.de/~k/ (FidoNet: 2:240/2188.18) [A735 47EC D87B 1F15 C1E9 53D3 AA03 6173 A723 E391] (Finger [EMAIL PROTECTED] to get public key) signature.asc Description: OpenPGP digital signature
Re: [PHP] help in php script
PRINT is nothing but... TimeRotateImage.php ?php $curr_time = (localtime()); if ($curr_time[2] = 6 and $curr_time[2] = 17) { print img src='image1.jpg'; } else { print img src='image2.jpg'; } ? this script (something like this) should be called from another script like, ?PHP print img src='TimeRotateImage.php'; ? did you get what i am saying? please let me know if you have some solution. thanks Klaus Reimer wrote: Deepak Dhake wrote: But i am not getting any output if i follow the above procedure. Can you tell me how to do it? I have to have the script TimeRotateImage.php which calculates which image to print accoring to local time and i want to embed the file name in html tag to print it on screen. It's not clear what your PRINT macros are doing. Maybe you forgot to send the content-type-header? Or maybe there is a script error which is not displayed when you call the page inside a image tag. Call the script directly in your browser to see what's going on. If it outputs binary data then everything is working but you forgot the content-type header. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help in php script
Deepak Dhake wrote: ?PHP print img src='TimeRotateImage.php'; ? did you get what i am saying? please let me know if you have some solution. thanks No. I must admit, It don't understand it. Let me try: You have a script a.php which outputs this static content: img src=b.php b.php outputs the static content img src=c.jpeg This can't work. You browser tries to download an image with the name 'img src=c.jpeg'. I think THAT's your problem and the reason why I did not understand you problem. If you use a PHP script inside an img src attribute then this PHP-Script must output an image. Complete with content-type header and the image as binary data in the body. Or another solution for a.php: html body img src=?php include('b.php')? / /body /html but I don't see the sense here. You can just do all this in one script: ?php $curr_time = (localtime()); if ($curr_time[2] = 6 and $curr_time[2] = 17) { $img = 'a.jpg'; } else { $img = 'b.jpg'; } ? html body img src=?=$img? / /body /html If I still misunderstood your problem then maybe your description was not detailed enough. -- Bye, K http://www.ailis.de/~k/ (FidoNet: 2:240/2188.18) [A735 47EC D87B 1F15 C1E9 53D3 AA03 6173 A723 E391] (Finger [EMAIL PROTECTED] to get public key) signature.asc Description: OpenPGP digital signature
Re: [PHP] help in php script
Klaus Reimer wrote: This can't work. You browser tries to download an image with the name 'img src=c.jpeg'. Ah, I'm talking nonsense. I meant the browser tries to DISPLAY an image with the CONTENT 'img src=c.jpeg'. The browser can't do this. That's why you don't see anything. -- Bye, K http://www.ailis.de/~k/ (FidoNet: 2:240/2188.18) [A735 47EC D87B 1F15 C1E9 53D3 AA03 6173 A723 E391] (Finger [EMAIL PROTECTED] to get public key) signature.asc Description: OpenPGP digital signature