You are hereProjects / photopic (Drupal module)

photopic (Drupal module)

By Administrator - Posted on 17 December 2009

What is photopic?

The photopic module is a very simple Drupal 6.x module with only the simplest of features. Once installed and a menu link created for it, any public Picasa web albums can be displayed on your website.

Please note that the module is currently in beta, but it does work :)


Main Features

  • Display public Picasa web albums from any Picasa account
  • Support for lightbox2 module
  • Photo auto resize to maximum defined size, keeping aspect ratio (if lightbox2 is not used)
  • Switchable options to display album description and photo captions
  • Custom CSS


You may post your feedback, comments, suggestions in the PhotoPic forum.

photopic-0.4.8-beta.zip3.21 KB
photopic-0.4.9-beta.zip3.34 KB
photopic-0.5.0-beta.zip3.65 KB
photopic-0.5.2-beta.zip3.66 KB
photopic-0.5.3-beta.zip3.88 KB
photopic-0.5.4-beta.zip3.88 KB
photopic-0.5.6-beta.zip4.35 KB

Dear Kevin,

I was VERY happy to have found your module. (And I am sad to see that it won't make it soon into the official modules collection.)

It works like a charm. The lightbox navigation was also a needed addition.

- - -

About my request:

I would like to have the 'Photos' page (where we display all photos from one album) like this:
- the page title is the current $albumtitle
- after the backlink, there is a division with the current $page_content_album_description

I couldn't hack it.

The page title is now set in photopic.module line 46 (as of version 0.5.4), but I suppose it has to be set in quite a different way to use the variables.


Hi Richard,

I have noted your suggestions and will see what I can do

- I do intend to add the album description somewhere hopefully in the next version.
- I will do a little bit of research on changing the page title to show the album name. This will be switchable on/off through the admin page.

Thanks for your suggestions,


Hi Kevin,


In the mean time, maybe you could consider setting up a PayPal Donate button for us users to be able to support/contribute to the developement of this module of yours.
There are some people for whom not having a fair exchange is unconfortable. :)


Hi, Kevin!
I use 0.5.4 version.
When I try to login on my site the blank screen appears.
Then I reload the page and logining is ok.
But some errors appears:
warning: Cannot modify header information - headers already sent by (output started at /.../docs/sites/all/modules/photopic/photopic.module:1) in /.../docs/includes/ on line 99.
warning: session_regenerate_id() [function.session-regenerate-id]: Cannot regenerate session id - headers already sent in /.../docs/includes/ on line 102.
In older versions of these errors was not.

Can you help me?

It seems that the error you are experiencing might not be specific to Photopic.

I have researched the error and found an article about that error:

The article seems to mention a problem in the template.php which might have ?> and new lines after it.

In your case the error might be in the file called

Can you find this file and have a look at the end of it. Let me know if this solves the problem or not.

The file should be in a folder called docs (docs/includes/

Awaiting your reply,


Kevin, thanks for trying to help!
But the problem is present.
I check files and template.php, but there is no ?> at the end of the file.
I try to write ?> to the end of this files, but it did not solve the problem.
When I disable the Photopic the errors disappeared.
And after enable Photopic the errors appears again.
I'd like to understand what was happening.
Great thanks!

Having the files without the ?> should be ok. Just make sure that there are no blank spaces/lines at the end as PHP might choke.

Meanwhile, I am doing some tests on the module to try and reproduce the error.

Can you check the memory limit of PHP on your server? (See instructions below to find out the php memory limit).

If you can email me directly by using the form in my Contact Me page and filling in the email field, we can correspond through normal email. I will try and help you as much as I can.


1) Create an info.php (The mem limit may not be displayed in the results, depending if your host allows it or not)


2) Upload it to anywhere in your website. Then access it.

3) A page will load up showing you a lot of information about PHP.
Look for the following info:


..............PHP Core

Directive.........Local Value......Master Value
memory_limit....?M................?M (<-- Look for these values!)





The errors was not in Photopic.
Details I wrote by e-mail.
Thanks for the module, Kevin!

responded by e-mail...

Hi, Kevin!
Thanks u for this module.
I think it would be nice to bring a picture from picasa in the block view. How can this be better to do? Probably should be use functions from your module?
WBR, Serhio.

Thank you for your nice comments and suggestions. I have jotted down your suggestion in my brainstorming notebook, and hope to be able to bring your idea to life in future versions :)


I, using Custom Filter module, created HTML Filter for photopic_page() function - very nice! Thank you!

Pattern: /picasa#([\d]+)/
Replacement text:
$result = photopic_page($matches[1]);
return $result;


Thank you for creating an HTML Filter, however I am not familiar with the Custom Filter Module and still trying to figure out what it does :) Does it replace the URL dynamically?



Just want to say great module.
Works amazingly well and super easy to set up.

I do have one question though, is there anyway to set it up so each photo once you drill down into the single photo, to have comments allowed at the bottom?
i would love to be able to comment on photos.


Thanks for your comments :)

The main purpose of the module is to only display photos and information from Picasa albums. No data is sent back to Google's servers. To answer your question, I do not intend to implement it - although I am keeping all doors open.


New version!!!
I'll try it now...
Great thanks, Kevin!!!

Hi, Kevin!
Great thanks for this module.
When will the new version? (very much we wait...)

Just released a new small update :)

I know it's been a while since I last worked on the project, but work has been eating fairly large bits off my free time.

Next week I have reserved a few hours for my hobbies (incl. Photopic coding) which I am looking forward to :)


Hi Kevin and thanks for the great module! Just one question/feature request: would it be possible to also display the description field from each photo? That would make this the perfect module for a site I'm working on right now.


The latest beta adds switchable options in the admin page for the display of album descriptions and photo captions. I am still testing that they are working fine, and if you do test it out let me know if you have any issues.




Will see what I can do to add that feature - I am guessing it would not be too difficult to display an extra field :) I think that it would be best to put it as an option in the settings, so that it can be switched on/off as required. I plan to continue working on the module sometime next week.

I will also be researching about how to enable lightbox navigation.


That would be perfect. I wish I could offer to help, but I'm not a developer. All I can do is say thanks at this point!

Hi Kevin

Thank you for the good work, I appreciate it, very much!

Some suggestions from my side:
- Make the thumbnail size (Album / Photo) re-sizable (I could do this via css e.g. ".photo_thumbnail > a > img {width: 222px;}" but that's very shoddy)
- Implement a "Forward" and "Backward" button (<< / >>) to navigate within the photos (page or lightbox view)

Keep up the good work!


Thanks for your comment and suggestions.

With regards to thumbnail size, I will look into this in a later version, but as you mentioned, it can easily be done through CSS. On first thoughts, resizing thumbnail images would require them to be stored/cached on the user's website and I would like to avoid using this method. But it still could be an optional feature where one could enable/disable it.

Navigation is another thing that I want to improve, but at the moment I have slowed down progress a bit to focus more on testing and fixing any problems.

Kevin, Thank you for this amazing module. I looked for hours for a good module to handle picasa images. Please keep it going.
un saluto

Thanks for your nice comments. It's nice to receive so much interest in my module, as it means that I am doing something right :)

I will surely keep working on the module!

Un saluto anche a voi,


I also thank you for the module.
That's all I was looking for.

I wanted to ask if in future versions include a navigation between photos (without lightbox)

I will look at your upcoming features and congratulations on the module, I hope you keep working on it.


Navigation between photos is one of the things that I want to improve in future versions, both if lightbox is used or not. However for the time being, I am making sure that it works well with as few bugs as possible and cleaning up the code, which will make adding new features a lot easier :)



Locally I refactored some and added css. Now it works well without clean urls.
Basically I used the l function where needed and minimized the div's (no CSS in code anymore).
If you want I can email it to you.
Here is a diff list of my alterations:

Index: css/photopic.css
--- css/photopic.css (revision 0)
+++ css/photopic.css (revision 6)
@@ -0,0 +1,23 @@
+ Document : photopic
+ Created on : Jan 28, 2010, 12:15:52 PM
+ Author : eddy
+ Description:
+ Purpose of the stylesheet follows.
+ TODO customize this sample style
+ Syntax recommendation
+.album_thumbnails a{
+ display:inline-table;
+ width:160px;
+ margin:0 10px 10px 0;
+.photo_thumbnails a{
+ display:inline-table;
+ width:100px;
+ margin:0 5px 5px 0;
Index: photopic.module
--- photopic.module (revision 5)
+++ photopic.module (revision 6)
@@ -8,6 +8,13 @@
* The PhotoPic module makes it very easy to display any publicly available albums from a Picasa Web Albums account.

+ * Add our own CSS file to drupal
+ */
+function photopic_init() {
+ drupal_add_css(drupal_get_path('module', 'photopic') . "/css/photopic.css", 'module', 'all', TRUE);
* Implementation of hook_menu().
@@ -85,10 +92,9 @@
// Find and display photo when lightbox is not used.

// Create back link
- $page_content .= '' . t('Back to albums') . '
- $page_content .= '' . t('Back to photos') . '

+ $page_content .= l(t('Back to albums'), 'photopic') . '
+ $page_content .= l(t('Back to photos'), 'photopic/' . $pic_album_id ) . '


foreach ($sxml->entry as $entry) {
$gphoto = $entry->children('');

@@ -110,7 +116,7 @@

// Build output.
- $page_content .= '';
+ $page_content .= '

@@ -133,6 +139,7 @@
// Create back link
$page_content .= '' . t('Back to albums') . '


+ $page_content .= '

foreach ($sxml->entry as $entry) {
$gphoto = $entry->children('');

@@ -142,12 +149,13 @@

// Build output (add rel= attribute if it is specified).
if (!$pic_use_lightbox) {
- $page_content .= '

' . '

+ $page_content .= l('', 'photopic/' . $pic_album_id . '/' . $gphoto->id, array('html' => true));
else {
- $page_content .= ' ';
+ $page_content .= l('', $pic_photo_url, array('html' => true, 'attributes' => array('rel' => 'lightbox')));
+ $page_content .= '

@@ -164,6 +172,7 @@
else {
// Display all albums.
+ $page_content .= '

foreach ($sxml->entry as $entry) {
$gphoto = $entry->children('');

@@ -172,8 +181,9 @@
$albumtitle = $media->group->title;

//Build output.
- $page_content .= '

+ $page_content .= l(''.$albumtitle.'', 'photopic/' . $gphoto->id, array('html' => true));
+ $page_content .= '


That's great! :) (I am assuming the previous comment is your, right?)

I have added custom css feature, filename can be set in admin page, just before reading your comment. I would like to go through your alterations and merge them together to improve what is already there.

I would appreciate it if you send me the modified module by email (, as I am not familiar with version control.... yet! ... still learning :)

By looking at both the module with your alterations and the cvs code that you pasted in your comment, I will probably understand more about it.

I would also be more than happy to give you credits and linking to your website if you want, so let me know in your email.



I was happy to sent you my copy, I just sent it, it should be there now (

It works beautifully with clean urls on, but not with clean urls off: it shows the albums, but not the photos.
Unfortunately, my host doesn't support clean urls (windows machine i think).

I guess a bug has been discovered ;) hehehe

will have a look at it... tks :)

I get this message, when I take a look on myURL/photopic page if I use the 0.4.9.beta version, also if I use your "kevincarbonaro" account name.

Have you any idea, why dosen't works for me?

(I like your solution to show Picasa albums in Drupal portal. If this modul works perpectly, then I'll recomend to put under the



try to acivate the php function "fopen"


The module first tries to load an xml file from the google servers which lists all the albums from your account. If this file cannot be loaded for some reason, there must be some sort of connection problem on your server where the website is hosted, thus throwing a friendly error.

This seems to be confirmed by the fact that my albums work on my website, but not on your website (using kevincarbonaro) as account name.

Can you send me the url of your website? I will try to help you out in any way I can.



Hi Kevin, thanks for this module, it works great on my drupal site! I was wondering, how can I translate this module? I've seen the text in the photopic.module, but am not sure how to edit it.

I am quite new to drupal development and this is my first working module. I am not sure yet how translation works in Drupal, although I have tried to use standard drupal function in my code to enable translation.

If you need a version translated to your language, send me a text file with the text that I need to replace with your translations and I will make it available online.


To create translateable contributed modules is really easy.

Here is a perfect documentation for contributed modules translation process How to contribute by editing .po files or Translation of contributed modules


I have used the t('') function extensively throughout the code where appropriate, so it should already be easily translatable then. I will surely read the articles linked in your comment to learn more about it.

tks :)


This is exactly what I was looking for to display picasa albums in a drupal site. Thank you so much!!

I do have some thoughts on improving this though...

First, separate all of the css into a separate file. Shouldn't be too hard, just create a class everywhere there is currently a style and move the css.

Also you use id's where there should be classes. Ids are supposed to be used only once on a page, classes are for re-using. Most browsers still handle this ok, but it does throw up a lot of errors in a validator.

Another thing I noticed is that when an album has a long title it makes the album to the right of it move over, keeping the long title on a single line. This is actually what made me dig in and discover the first two points. I was playing with firebug and was going to add the width property to the text block, then I realized there was no class, the style was applied individually. I'm not sure how this would be fixed, it might be easy if the css is separate. Guess that's the first step.



Thank you for you comments.

I am seeing an increasing interest for my module, which is great and encourages me to improve it more.

I am intending to continue working on the module, now that I am back from my 3-loooong week holiday :)

Will see what I can do to improve css and also separate it into a stand-alone css file.


I have just installed it and it works exactly as i needed it to, many thanks for the module!