Jurik Posted December 11, 2006 Share Posted December 11, 2006 Hi guys, I've been asked to add a radom image generator to a site that is using Mambo to create it's web-site in. At the moment the image that is needed to become a random image is using the following code [code]<img src="<?php echo $mosConfig_live_site; ?>/templates/waterandstone_green/images/img_header.jpg" alt="header image" />[/code] Now I have tried to add some scripts I have found on the net to make this image randomly selected but I just cant seem to get it to work, can anyone help me out? Link to comment https://forums.phpfreaks.com/topic/30217-adding-a-random-image-generator-in-exisiting-php-code/ Share on other sites More sharing options...
JasonLewis Posted December 11, 2006 Share Posted December 11, 2006 well you how much other images are there. i am guessing you are changing img_header.jpg?well just have a couple of those with a number on the end. then use the rand.[code=php:0]<img src="<?php echo $mosConfig_live_site; ?>/templates/waterandstone_green/images/img_header<?php echo rand(1, 4); ?>.jpg" alt="header image" />[/code]remember to change the 4 to however many images there are. Link to comment https://forums.phpfreaks.com/topic/30217-adding-a-random-image-generator-in-exisiting-php-code/#findComment-138928 Share on other sites More sharing options...
Jurik Posted December 11, 2006 Author Share Posted December 11, 2006 [quote author=ProjectFear link=topic=118168.msg482584#msg482584 date=1165838603]well you how much other images are there. i am guessing you are changing img_header.jpg?well just have a couple of those with a number on the end. then use the rand.[code=php:0]<img src="<?php echo $mosConfig_live_site; ?>/templates/waterandstone_green/images/img_header<?php echo rand(1, 4); ?>.jpg" alt="header image" />[/code]remember to change the 4 to however many images there are.[/quote]Thats works a treat, thanks alot Link to comment https://forums.phpfreaks.com/topic/30217-adding-a-random-image-generator-in-exisiting-php-code/#findComment-138932 Share on other sites More sharing options...
JasonLewis Posted December 11, 2006 Share Posted December 11, 2006 no problems. glad i could help. :) Link to comment https://forums.phpfreaks.com/topic/30217-adding-a-random-image-generator-in-exisiting-php-code/#findComment-138937 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.