All of this code was stripped from the block module. You can drag and drop photos to sort them and when you click save sort the database will be updated. Easily move photos to a different album and navigate to your other albums by clicking on the album name. Added an add photos link in the top right corner to improve flow.

To access the sort page.. there is no link yet.. /photos/album/4/sort
so, /photos/album/%node/sort

It requires imagecache and of course album photos (photos). Upon installation imagecache preset will be added "photos_sort" 50x50..

It would be cool to have little blocks with the thumbnail only instead of one long row for each photo, but javascript scares me..

**Potential problems with large albums. Imagecache load time.. and not practical to use with more than 20 images..

Open to feed back, suggestions and help with the code! I really want this functionality for my new website!!!

Comments

vako’s picture

THANK YOU!! this will be a valuable addition to the module indeed.

Here's some feedback about my experience:
After enabling the module, I got the following error (refreshing the page seems to have fixed it):
Fatal error: Call to undefined function imagecache_preset_save() in /home/wwwaec/public_html/sites/all/modules/photos_sort/photos_sort.install on line 4

The module works fine, but the thumbnails are all showing as broken links, I check that the folder:
/sites/default/files/imagecache/photos_sort/photos/image doesn't exist, even though I have ImageCache installed but not sure how/where to configure it, any suggestions for a fix?

thanks!

nathaniel’s picture

Hmm, definitely a problem with the imagecache during install. To anyone else, make sure imagecache is up to date with the latest release before install.

Navigate to: /admin/build/imagecache and add new preset photos_sort add the actions that you prefer, anyone else can edit the actions there as well if you prefer a different size thumbnail.

Also, clearing cache may help: /admin/settings/performance

vako’s picture

After creating the preset, the thumbnails showed-up. However they were original size - huge! I had to create an Action as Scale to 150x100 to make them display as thumbnails. Is there any other way?
I think this module should be called Photo Re-arrange, since it's not really sorting, it's re-arranging the photos...;)
Question: is there any possibility that the re-arranging option can be done at photos/album/### level? (just hoping)

Thanks for the solution!! Woo hoo!

vako’s picture

I hope you can make the same functionality for the Albums section as well: /photos/album

eastcn’s picture

cool, thanks

nathaniel’s picture

StatusFileSize
new5.78 KB
new79.46 KB

I made a few changes to the css file and template page. Now it is more practical for larger albums.

For this to work properly you have to make a few changes to the photos.module file.

function photos_image_pager around line 653 add ,p.wid ... ORDER BY p.wid ASC

<?php
function photos_image_pager($fid, $id, $type = 'pid') {
...
  $result = db_query(db_rewrite_sql('SELECT p.pid, p.wid, f.filepath, f.fid, f.filename FROM {files} f INNER JOIN {x_image} p ON f.fid = p.fid WHERE '.$sql.' = %d ORDER BY p.wid ASC', 'p', 'pid'), $id);
?>

function photos_order_label Weight - smallest first will be weight|asc and largest first will be weight|desc around line 1540.

<?php
function _photos_order_label(){
...
    'weight|asc' => t('Weight - smallest first'),
    'weight|desc' => t('Weight - largest first'),
?>

Now in the admin section: admin/settings/photos global settings set default Image display order: to Weight - smallest first.

plato1123’s picture

Nice module! Does this was have it's own modules page? Anyone improving it?

w00’s picture

Nice module!

Hi,

Yes, it's a fine module - eastcn has an enviable knowledge of PHP & Drupal.

Does this was have it's own modules page?

Link is "album photos" at top of page; see: "album photos » Issues"

Anyone improving it?

That's a very good question.

The various issues pages have a bunch of user-submitted patches, but I don't think anyone's put them together in one release. It would be challenging and mostly worthless unless we could get eastcn to bundle them into a fresh release that would be automatically updated on all installations using Album Photos.

Myself, I've created a Photos Search module that adds a Photos tab to the Search page, enabling searching of photos' Titles & Descriptions. My albums tend to have a brief description and no comments, but lengthy descriptions. So when searching through Drupal's normal Search page, nothing is found.

If normal Search did match an album description, and if there's several pages of photos, one would still have to page through all photos looking for relevant one. My module returns thumbnails of matching photos with links directly to the relevant image.

Ideally this should go into the main Album Photos module. I haven't released it as a separate module (yet). Ask if you're interested in trying it.

tl;dr

I've offered to assist in further development. No replies. We'd really need eastcn's cooperation ... or to deem project abandoned and assume maintenance (don't really want to do that).

summit’s picture

Hi,
For D6 this photos module is still great. Wil this be implemented please?
Greetings, Martijn

nathaniel’s picture

Version: 6.x-2.6-beta3 » 7.x-3.x-dev
Status: Needs work » Postponed

I still want to add some support for a grid view drag and drop re arrange by weight feature. Anyone know of any examples, especially Drupal related?

nathaniel’s picture

Assigned: Unassigned » nathaniel
Status: Postponed » Needs work
StatusFileSize
new120.08 KB
new43.75 KB

Testing a drag and drop grid interface. So far so good. Tested with 350+ images on localhost with no problem. Attached a screenshot from the demo site with 5 images.

Not sure about scalability at this point. The image order is updated ever time an image is moved. It might save resources, but be less user friendly, to have a button that says "save order" or "save changes". Click that button after all the images are in the right place to save the changes to the database.

At this point the weight has to be updated for every image in the album to be sure that they are in the correct order.

nathaniel’s picture

Title: Drag and Drop Photos Sort, like blocks » Drag and Drop Photos Re-arrange Grid
nathaniel’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)
Issue tags: -album photos, -sort

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