New Module: ItemChecksum

rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Tue, 2009-08-18 04:56

I'm not sure how useful this one will be to anyone other then me, but I've made a new module :)

ItemChecksum will allow you to view the MD5 and/or SHA1 checksum of any item (photo or video) in your Gallery. It does not have any theme integration, and instead must be accessed manually for each item you wish to view the checksum of.

For MD5 Checksum's, the URL is:
http://www.example.com/gallery/index.php/itemchecksum/md5/ALBUM_ID_NUM/FILE_NAME
Example

For SHA1 Checksum's, the URL is:
http://www.example.com/gallery/index.php/itemchecksum/sha1/ALBUM_ID_NUM/FILE_NAME
Example

The module will then search for the first file named "FILE_NAME" in the album represented by "ALBUM_ID_NUM" and display the corresponding checksum. In the event no such file exists, it will display a 0. In the event my KeepOriginal module is installed and active, ItemChecksum will first check for an original image and if found, display it's checksum instead of the fullsized image.

In addition to the above two URLs, this module module also contains an "album count" URL which will display the number of items in an album, excluding sub-albums.
http://www.example.com/gallery/index.php/itemchecksum/albumcount/20
Example

The module can be downloaded from my github, should anyone be interested:
http://github.com/rWatcher/gallery3-contrib/tree/master/modules/itemchecksum

There is also a wiki entry for this module:
http://codex.gallery2.org/Gallery3:Modules:itemchecksum

---
Report Problems/Suggestions Here | Get latest version | Documentation | Coffee Fund | My Library | My GitHub

 
talmdal

Joined: 2006-12-06
Posts: 358
Posted: Tue, 2009-08-18 12:17

Pulled to gallery-contrib
http://www.timalmdal.com

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Mon, 2011-08-08 17:52

Updated this module to include REST support.

The following URLs will return REST-friendly SHA1 and MD5 checksums.
http://www.example.com/gallery3/index.php/rest/itemchecksum_sha1/ITEM_#
http://www.example.com/gallery3/index.php/rest/itemchecksum_md5/ITEM_#

 
Sangie
Sangie's picture

Joined: 2010-10-31
Posts: 28
Posted: Sun, 2010-10-31 04:50

What I would like to see is if this module could be utilized when uploading images by other members so that it wouldn't allow duplicate images to be uplaoded if an image with that md5 checksum already exists. I'm building an art site that users can submit to and duplicates could get bad. I'm not sure how hard this would be..

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Sun, 2010-10-31 05:12

Hmmm... This module wouldn't really work for that. I built it more for comparing the contents of a local folder to the contents of a remote album in order to see what might have been modified after it was uploaded. As such, file checksums are generated as they're requested, and not stored anywhere (which would make it really slow if you had to checksum everything in your gallery at once).

You could probably use the code in this module as a starting point for some kind of custom upload module though.

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Mon, 2011-08-08 17:52

Minor update to the module -- I filled in the new fields in module.info that were added in Gallery 3.0.2. Otherwise everything has been tested and works fine with the current release of Gallery 3.