WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Droplets & Snippets => Topic started by: Luckyluke on September 26, 2008, 05:37:39 PM

Title: Picture of the Week
Post by: Luckyluke on September 26, 2008, 05:37:39 PM
Hi,

Here something for the PHP coders...

I have a folder under MEDIA, for example, "pic_week". In that folder are 52 photos with the names  pic-01.jpg, pic-02.jpg and so on until pic-52.jpg.
Well, I'm looking for a snippet that shows every week a new photo. So at week 5, it shows pic-05.jpg; at week 40 it shows pic-40.jpg.
I think this is a snipped that can be done in one line... but, I'm no coder... snif snif...  :cry:

Grtz,
Luc
Title: Re: Picture of the Week
Post by: doc on September 26, 2008, 06:25:05 PM
Hello,

without any checks if the image exists, you can use the following in the index.php of your template:
Code: [Select]
<img src="<?php echo WB_URL MEDIA_DIRECTORY?>/pic_week/pic-<?php echo date(&#39;W&#39;, time()); ?>.jpg" alt="" />
This should result in an output like:
Code: [Select]
<img src="http://localhost/webserver/wb27/media/pic_week/pic-39.jpg" alt="" />
Regards Christian
Title: Re: Picture of the Week
Post by: Luckyluke on September 26, 2008, 06:38:28 PM
Hey,

Thanks a lot. I will test it the following days.
What about week 1 to 10? is it pic-1.jpg or pic-01.jpg?

And there is no need for testing if the picture exist.

Grtz,
Luc
Title: Re: Picture of the Week
Post by: doc on September 26, 2008, 08:43:36 PM
Weeks should be in xx format (week 1 := 01).

Christian
Title: Re: Picture of the Week
Post by: Ruud on September 27, 2008, 10:52:02 PM
I have a folder under MEDIA, for example, "pic_week". In that folder are 52 photos with the names  pic-01.jpg, pic-02.jpg and so on until pic-52.jpg.

If this is true, you don't need to test.

Week 125 will not happen.

Ruud
Title: Re: Picture of the Week
Post by: Luckyluke on September 27, 2008, 11:18:06 PM
I've got this idea from the town where I go to ski every year.
On there site they got a "Foto der Woche".
It's no WB site. if you want to see it, click here (http://www.raggal.net). It's a little town on the west of Austria.

I just think something. We've got a module to display a rondom picture. Maybe the php-coders can change this module with a "picture of the day", "picture of ther week", "picture of the month" and a "random picture". Just an idea...

Grtz,
Luc
Title: Re: Picture of the Week
Post by: Ruud on September 27, 2008, 11:28:22 PM
If you look at the picture of the week, you see it is allmost 3 weeks old.

Looks to me, it is something they are doing manually whenever someone sends a nice picture.

That would be easy to build  8-)
Just create a wysiwyg page and add an image.  :-P

Ruud
Title: Re: Picture of the Week
Post by: Luckyluke on September 27, 2008, 11:36:13 PM
Yeah, you're right. That's why I will take some pictures and put it already in a map.
You know, this place is really a small town. When a chicken and a cow dies they must close the local zoo. The baker, mayor and fireman are all the same people  :-D    Just kidding...

Luc

// off topic
Ironically... they change the "foto der Woche" this week.