FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » displaying random images with an appropriate caption
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: displaying random images with an appropriate caption [message #175935 is a reply to message #175931] Wed, 09 November 2011 03:39 Go to previous messageGo to previous message
paris2venice is currently offline  paris2venice
Messages: 9
Registered: October 2011
Karma:
Junior Member
On Nov 8, 7:34 pm, paris2venice <paris2ven...@gmail.com> wrote:
> Is there any way to write something that will choose not just a random
> image but the random image and its caption as a pair?
>
> This is my code for my random images as it exists now but,
> unfortunately, it doesn't work very well if I don't have a caption
> with the photo (even if just to credit the photographer):
>
> <div style="float:right; width:363px;
>       margin: 1.0em 2.75em 1.0em 1.0em; padding: 0.25em;
>       text-align:center; background-color: #fff">
> <?php
>          $dir="/library/images/slideshow";
>          $images = array("$dir/farm-640x480.gif" ,
>                                 "$dir/ranch-640x480.gif" ,
>                           "$dir/plantation-640x480.gif");
>          $format='      <img src="%s"
>                            class="rounded-corners"
>                            style="width:360px;height:270px" />';
>          printf("$format", $images[array_rand($images)]);
>          echo "\n";
> ?>
> </div>
>
> Thanks for any help and/or suggestions.

I neglected to mention that I am not using MySQL or any other database
so I can't use that (at least not right now). Thanks.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: php development environment in windows problems
Next Topic: Images retrives
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 06:14:19 GMT 2024

Total time taken to generate the page: 0.03950 seconds