Welcome, Guest. Please login or register.
Did you miss your activation email?
May 24, 2012, 06:42:39 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155442 Posts in 21702 Topics by 7733 Members
Latest Member: DarrellDD
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Picture of the Week  (Read 1923 times)
Luckyluke

Offline Offline

Posts: 555



« on: September 26, 2008, 04: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
Logged
doc
Guest
« Reply #1 on: September 26, 2008, 05:25:05 PM »

Hello,

without any checks if the image exists, you can use the following in the index.php of your template:
Code:
<img src="<?php echo WB_URL MEDIA_DIRECTORY?>/pic_week/pic-<?php echo date('W'time()); ?>.jpg" alt="" />

This should result in an output like:
Code:
<img src="http://localhost/webserver/wb27/media/pic_week/pic-39.jpg" alt="" />

Regards Christian
« Last Edit: September 26, 2008, 05:26:36 PM by doc » Logged
Luckyluke

Offline Offline

Posts: 555



« Reply #2 on: September 26, 2008, 05: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
Logged
doc
Guest
« Reply #3 on: September 26, 2008, 07:43:36 PM »

Weeks should be in xx format (week 1 := 01).

Christian
Logged
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2294



WWW
« Reply #4 on: September 27, 2008, 09: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
Logged

Professional WebsiteBaker Solutions
Luckyluke

Offline Offline

Posts: 555



« Reply #5 on: September 27, 2008, 10: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. 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
Logged
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2294



WWW
« Reply #6 on: September 27, 2008, 10: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  cool
Just create a wysiwyg page and add an image.  tongue

Ruud
Logged

Professional WebsiteBaker Solutions
Luckyluke

Offline Offline

Posts: 555



« Reply #7 on: September 27, 2008, 10: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  grin    Just kidding...

Luc

// off topic
Ironically... they change the "foto der Woche" this week.
« Last Edit: September 30, 2008, 10:36:30 AM by Luckyluke » Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!