Are you considering to makea D7 version of this module?
It would work a lot better thx to the updated jQuery.

Members fund testing for the Drupal project. Drupal Association Learn more


julou’s picture

Just for the sake of curiosity… what kind of problem do you experience and what kind of improvement do you expect?
Thank you in advance for your answer…

PS: btw yes, I am considering a D7 port when I find some time.

Greg Adams’s picture

I haven't tried your module yet.. because I'm moving my development to D7...
So I can't tell you any issues...

I managed to integrate the original Photoswipe in D7, but a module would be a lot nicer..

Sorry I'm not a coder, so I can't help you on this...
I will be looking into making modules and If I figure out the basics I will definitely get back to you (I'm a reaaaallly fast learner)

perandre’s picture


bdevore’s picture

Component: Miscellaneous » Documentation
Category: feature » support
Priority: Normal » Minor

I just tried the photoswipe-813d464.tar.gz tree on my Drupal 7 installation, and I'm not having any success getting it working. It's not giving me any errors as far as I can tell (Javascript console isn't reporting any problems at least). I'm also not getting the option under Structure > Custom Content Type > Manage Display > Format to select PhotoSwipe, which if I'm understanding the Readme is where I should be able to enable it for my image gallery. I'd actually tried just manually loading everything up with the original jquery photoswipe js, but the script fails once it gets to the section that handles the image caching. Don't know if anyone else has had success getting it to run on D7. If you have can you share some of the steps you took?

Greg Adams’s picture

How did you integrate the plugin? Since there is no Drupal 7 module I guess you added it via your theme.
I had a testsite for this once but due to some lagging I removed it again.

From what I have learned so far, you can either integrate an "extra" version of jQuery and call the manually added scripts from that version (while drupal uses another version) or use the same version as Drupal.
If you are using the jQuery version integrated in Drupal you need to change your "$" to "jQuery". (Drupal changed that in d7 for compatibility reasons) The jQuery update module should also be installed to get jQuery 1.5.x

If you give us more detail about what exactly you did, it would be easier to find the reason why it's not working.

bdevore’s picture

I did try initially to add via the theme, Using the info file to import the .js using
scripts[] = foo.js
and wrapping the whole thing like so

// We define a function that takes one parameter named $.
(function ($) {
  // Use jQuery with the shortcut:
// Here we immediately call the function with jQuery as the parameter.

from the example on the javascript and jQuery page

I've got it targeting a set of field images in an unorder list ul
however one the first image loads, the console throws an error about the cache, and the script stalls. I think the rest of the script is the touch interface, and obviously the additional images. Additionally, when the script fires, it appends photoswipe and some other numbers to the end of the url. I'm afraid I'm not familiar enough with how drupal handles these types of requests to know what's going on, and I've not really found clear documentation as to why it would be appending the extra characters, unless that's a consequence of running the script through the info page of the theme?

Then I tried to use the tree located here and everything looks like it loads up without errors, but I don't get the option to select photoswipe in my menus for display type. It's been run through Coder Upgrade so I was curious if it would at least work from a proof of concept standpoint.

Greg did you implement it differently when you were manually loading it?

Greg Adams’s picture

Yes I did a completely different setup (I don't recommend it).
I am making a photoswipe site/theme soon so I could look into it, but right now I'm pretty busy.

What I did to get it to work, is integrate it as if it were on a static page (non CMS)
- include the an extra jQuery.js in the html.tpl.php
- include the script in the html.tpl.php
- define the fields as required via contemplate

There are many reasons, why I don't recommend this:
- contemplate is VERY buggy
- the swiping was very laggy
- too much of a workaround

markisatacomputer’s picture

Hey folks. Just slapped together a quick working version in D7 I needed for a project. I checked out the 7.x-1.x tree from the drupalcode repository.

Here's the patch. Might be a useful starting point for making a more complete 7.x-1.x version.

james.williams’s picture

For anyone scratching their head around getting the above patch working -- use the latest dev version of the 7.x-1.x branch (commitref 813d4648371c3f63df11cde32bd133f004ef4cf5) of the photoswipe module, and the latest zip download of the photoswipe library (from ). It will only work with the 'Use jQuery to load PhotoSwipe' setting OFF.

james.williams’s picture

This patch expands the above patch to pass the settings through to photoswipe correctly. There is currently no UI for setting these settings (the ones listed at The easiest thing to do is to manually set them in code if you have a custom module.

Lobart78’s picture

Can't u just pack that module that works on drupal 7 and post a .rar file here? what's the point of these patches anyway

AdamGerthel’s picture

Is it using the jquery or the standard version? The standard would be better since the jquery version requires 1.6

james.williams’s picture

Priority: Minor » Normal
Status: Active » Needs review

@AdamGerthel - it's the standard one if I remember correctly. Also, the patches posted markisatacomputer and I both require using photoswipe 3.0.4 (e.g. from ), with libraries, so that the code.photoswipe-3.0.4.min.js file is available in the directory that libraries picks up. (e.g. sites/all/libraries/photoswipe/code.photoswipe-3.0.4.min.js )

@Lobart78 - This is how the development workflow of a module works. We post patches against the latest dev version of the module, in order to forward its progress. The patches (or similar) will hopefully then be merged into the module. To get a patched version of the module, take a look at and follow the instructions for checking out the dev version from Git and how to apply a patch. Please test it out and report your findings here as it will speed up getting the changes merged into the actual project.

AdamGerthel’s picture

julou doesn't seem to be very active on this module. Photoswipe is going to increase in popularity since mobile usage is growing bigger and bigger, so a working module would benefit the community.

Is anyone up for the task of co-maintaining the module?

colin.not’s picture

has anyone gotten the D7 patch to work with a view to create a thumbnail gallery? it appears to work great in an article but i cannot figure out how to do a basic image gallery with photoswipe enabled.

format: table

content: image (formatter set to photoswipe)

thanks in advance

designguru’s picture

I just got this working with no problems - save for the fact that the photoswipe js seems not to be called on Views...


designguru’s picture

As a stop-gap I just ended up calling the script's js and css from my theme's html.tpl.php file - which is non ideal as the module is also writing those into the headers on specific nodes but I haven't seen any problems with the double calls in terms of the script working - looks good to me!

When is someone going to finalise a drupal 7 module for Photoswipe with a stable release? There's probably thousands of sites which could use it.


ParisLiakos’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Category: support » task
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.