This concept was slightly changed versus previous Photoblog on Drupal idea. The biggest thing missing with the new concept comparing to the previous one is lack of any user level permissions. Any kind of private content was not so popular among my friends and colleagues so it was dropped (everybody prefer email for this type of images).
There are more nice modules available now. It somewhat forced to add more nice features (like front page slideshow). And it also made possible to bring any custom coding to its minimum. Tagadelic for example now allows to adjust amount of tags per each cloud block right in block settings. And any random image needs are managed by views module now. Cool!
Why it is still on Drupal 5 but not 6? The only reason is: as of today not all the modules used are yet available for Drupal6.
#1. Mission critical set of modules:
- Image v.2 (it's in alpha now, but it allows to make sexy square thumbnails)
- Views (ah... Views is the second thing after Drupal core)
- Views RSS (to handle RSS publishing from your views)
- Views Slideshow (for front page slideshow and maybe more)
- Tagadelic (tag clouds)
- Tagadelic Views (advanced tag clouds based on views... not yet used)
- Spam (fight comment spam)
- Pathauto (lovely clean urls + helps to show some blocks relative to path)
- Token (needed for Pathauto and Custom Pagers)
- Custom Pagers (previous / next pager at the top of an image)
- Content Templates (in this case only to fix RSS output)
- Code Filter (if you wish to publish code in your blog)
- Scheduler (little secret: if you are serious about exactly daily posts you may preprogram Drupal to publish photos while you are out for a week)
- CAPTCHA (fight comment and contact form spam)
#2. Front page
Front page is made of 2 basic elements: views slideshow and a block in content region generated by views to show 1 last blog post (without pager or "more" link). You will need to set Drupal frontpage (in admin / site information) to the page generated by your slideshow view.
Slideshow runs 10 random images which has been promoted to the front page. Here is a trick: you should promote only landscape oriented images (or some of them). Portrait oriented images will break the layout / will not look nice.
#3. All images page and blog page
Latest (or all) images view provides a page of all image thumbnails sorted in reverse chronological order. It also provides a block of 6 latest images and RSS feed. The view is set to List View type with one field: Image: Display Image + Image with link + Thumbnail.
A piece of CSS to give the thumbnails proper flow:
.view-latest .item-list ul, .view-random .item-list li {
margin: 0;
padding: 0;
display: block;
float: left;
}
The blog page is done basically the same but just change image thumbnails to blog node title and set it to Teaser View type.
#4. Changing number of thumbnails per taxonomy page
Why would we change usual taxonomy output: by default Drupal gives you 10 node teasers (image thumbnails for this project) per page. It is not really enough if you deal with relatively small thumbs. One more thing to keep in mind is exact number of thumbnails per page. For example I have 24 of them (to match the 8 lines of 3 thumbs each) but default Drupal setting would allow exactly 10-15-20-25-30.
How to achieve this? Easy: go to your views admin page, push "add" in default views for taxonomy_term view. Adjust the number of nodes per page view. That's it! (But it will affect our blog tags output as well, hm... we'll deal with it later).
#5. Image node template
As we do not use any special prepared view to list taxonomy terms (re: #4) we need to modify image node template to show only thumbnail. This way normal teaser output will produce a nice thumbnail flow. Here is the code (put it to your node-image.tpl.php):
<?php if ($page == 0): ?>
<div class="node image teaser<?php print ($sticky) ? " sticky" : ""; ?>">
<?php print $node->content['image']['#value'] ?>
</div>
<?php else: ?>
<div class="node image body<?php print ($sticky) ? " sticky" : ""; ?>">
<div class="content"><?php print $content ?></div>
<?php if ($links): ?>
<div class="info">
<div class="links"><div class="node-tags">tags: <?php print $terms ?></div>more: <?php print $links ?></div>
<div class="submitted"><?php print $submitted ?></div>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
And some CSS to wrap it nicely:
.node.image.teaser {
width: 155px;
float: left;
margin-bottom: 15px;
}
#6. RSS for front page
Random image slideshow looks great at front page. But the RSS feed that might be generated with Views here would be a mess. That's why we need something more logical. The best would be to take the feed from All Images view (re: #3).
One option (without any coding) is to use Feed Path Publisher. But I didn't like the module's behavior: it adds extra feed of your choice to every page.
The other option is to use a code snippet to add the feed to front page only. Place the code in your theme page.tpl.php (right after <?php print $head ?>
):
<?php if (drupal_is_front_page()): ?><link rel="alternate" type="application/rss+xml" title="<?php print $head_title ?>" href="/all/feed" /><?php endif; ?>
#7. Image thumbnails in RSS
Quite an important thing to take care of are RSS feeds. The image module (still, it a bug but not yet fixed as far as I see) lacks RSS friendly output. So the thumbnail is not present in RSS feed. It is quite easy to fix: install contemplate module, enable it and alter RSS output for image node about as follows:
<img src="http://andreys.info/<?php print $node->images['thumbnail'] ?>" alt="<?php print $node->title ?>" /><?php print $body ?>
Voilà! Your thumbs are on feed now. This snippet accomplishes one more task: default RSS feed has (actually it had when it worked with image module) only relative thumbnail links. But now we have fully qualified uri for thumbs. And it really helps with not-so-wise RSS readers.
#8. Custom pagers
To enable previous / next navigation for images (as it is photoblog we use timeline as criteria) use custom_pagers module. Just add a new custom pager for image node type to use "latest" (re: #3) view. That's it.
#9. Resumé
That's it! Some more polishing and endless adjustments will follow here and there. But now you have your so very personal photo + text blog!
And well, yes, I forgot something... most probably you'd want to use some lovely custom Drupal theme :) But it's another story.
Thanks for sharing. I might use it for my blog. But as far as I know RSS issue was fixed with image module.
Andrey, nice clean-looking site!
Do you know where I can find a gallery of Drupal sites alongside the code that generates each site?
Thanks!
As far as I know there are nothing like "centralized" sites. You may pick up at least set of modules occasionally at Drupal showcase forums or DrupalSites. Plus there are a lot of individual posts at misc. Drupal developer blogs of course.
The best way to get this kind of information is Google probably.
Thank you Andrey,
very useful and helpful.
With help of this article I set up my image blog at http://www.artiststranger.com. I credited you on my About page.
Many Thanks
thanks for all the useful information I'll try to implement it on my clients websites.
Trying to make a this work with drupal 6.
However the tags in tagadelic are pointing to /taxonomy/term/57
I already made a custom view; /photos/tags/ambulance shows all ambulance thumbnails. How to edit the links within tagadelic?
What am i doing wrong?
Hey Bert,
Most probably you don't have pathauto module (http://drupal.org/project/pathauto) installed / configured. Just try it out and make sure you check bulk path generation at module settings (for nodes and taxonomy terms).
Hope it helps.
Why no links int the module list, it would be more easy to find all modules with links ;)
//Fredrik
thanks for this infor. how can i show embed links to allow visitors embed my picts on their website? how can that be done.
The only solution I know would be tweaking you theme for photo node type. You can easily find the value to include with ContentTemplate (contemplate) module.
Currently I use slightly different approach on this blog with CKK + ImageField + ImageCache. So for me the line of code would be something like this:
It might be a bit different for you though.