Module: tiffupload - Upload TIFF images (with revision support)

alivin70

Joined: 2013-04-03
Posts: 13
Posted: Tue, 2013-05-07 17:49

Hi All,
I developed a module to upload TIFF files.
It is derived from rawphoto, so credits to the author Chadparry :)

The module will allow you to upload TIFF images like normal photo.
The image is converted in JPEG for thumbnailing and preview. The original file is saved and you can download it from the menu "Photo Options -> Download original TIFF"

At the moment it works only with ImageMagick

The module is in very alpha stage, so use it carefully and at you own risk for testing only.
Thanks to user nerve2 the module is in beta stage.

Any help for debugging and improving is appreciated :)

CHANGELOG
2013-08-30 V4.3 Bug fix in the update event

2013-08-18 V4.2 Added support to version 4.1 to copy over the exiv data from tiff to the jpg, if exiv2 is installed (thanks to Nerve2).

2013-07-17 V4.1 Added a modified File Proxy controller named dam_proxy.php

2013-07-17 V4 Major change in the module. Now it supports file replace and versioning, with a different file repository

2013-07-18 V3 Added support to version 2 to copy over the exiv data from tiff to the jpg, if exiv2 is installed (thanks to Nerve2).

2013-06-26 V2 The user Nerve2 made an update of the tiffupload module.
New features and bug fixes:
* No more need of the keeporignal module (similar functionality implemented in this module)
* Keeps the orginals (only tiffs) in a parallel folder structure (original_tiff)
* Works with subfolders
* Keeps track of rename and move events and maintain them on the orginal files, too
* Changed from Alpha to Beta state ;-)

2013-05-07 V1 First release of Tiffupload

DOWNLOAD

* Latest V4.3
* V4.2
* V4.1
* V4
* V3
* V2
* V1

 
xarope

Joined: 2012-01-26
Posts: 10
Posted: Thu, 2013-05-09 02:14

Thanks for this. Will test it out when I get the chance.

BTW, at least on ubuntu, you can install the package called "graphicsmagick-imagemagick-compat". The package description:

GraphicsMagick provides a set of command-line applications to manipulate image files. It is a fork of the ImageMagick project and therefore offers a similar set of features, but puts a larger emphasis on stability.
With this package installed, the GraphicsMagick command line tools can be executed like their ImageMagick counterparts. It allows to migrate scripts from ImageMagick to GraphicsMagick without any code changes.

I use the "convert" (instead of "gm convert") command right now to convert my TIFFs. Your code currently doesn't use any parameters so it should work easily.

 
alivin70

Joined: 2013-04-03
Posts: 13
Posted: Fri, 2013-05-10 11:51

I agree with you xarope.
At the moment I have ImageMagick in production, so I don't need a porting, but maybe others do.
Anyway, the porting should be quite simple, just as adding a block of code here

     switch ($toolkit_id) {
        case 'imagemagick':
          $cmd = escapeshellcmd("$toolkit_path/convert");
          //$cmd .= " -quality " . escapeshellarg($image_quality . "%");
          $cmd .= " ".escapeshellarg($input_file) ." " . escapeshellarg($output_file);
          $toolkit_compat = true;
          break;
        default:
          log::warning("tiffupload", "Cannot convert Tiff Image with graphics toolkit: " .
                                   $toolkit_id->active);
      }

in helpers/tiffupload_graphics.php

 
nerve2

Joined: 2013-06-25
Posts: 4
Posted: Tue, 2013-06-25 09:56

The module doesn't work out of the box at >=3.0.7.

To make it work, please add the following function to tiffupload_event.php at line 63

  static function photo_types_by_extension($types_wrapper) {
    if(!isset($types_wrapper->types_by_extension["tiff"]))
                $types_wrapper->types_by_extension["tiff"] = "image/tiff";
    if(!isset($types_wrapper->types_by_extension["tif"]))
                $types_wrapper->types_by_extension["tif"] = "image/tiff";
  }

Can you please insert this function to make the module work at newer relases ?

 
nerve2

Joined: 2013-06-25
Posts: 4
Posted: Wed, 2013-06-26 13:45

Hi everybody,

I have made an update of the tiffupload module.
New features and bug fixes:

  • No more need of the keeporignal module (similar functionality implemented in this module)
  • Keeps the orginals (only tiffs) in a parallel folder structure (original_tiff)
  • Works with subfolders
  • Keeps track of rename and move events and maintain them on the orginal files, too
  • Changed from Alpha to Beta state ;-)

Thank's to the orginal developer's of tiffupload and keeporginal !

 
alivin70

Joined: 2013-04-03
Posts: 13
Posted: Thu, 2013-06-27 15:22

Dear Nerve2
THANK YOU VERY MUCH!

You made lots of improvements! I was working on same issues, you saved me so much time!

 
nerve2

Joined: 2013-06-25
Posts: 4
Posted: Fri, 2013-07-05 09:45

Hi everybody,

I have made a derived module which is for eps files (epsupload).

Features:

  • No more need of the keeporignal module (similar functionality implemented in this module)
  • Keeps the orginals (only eps) in a parallel folder structure (original_eps)
  • Works with subfolders
  • Keeps track of rename and move events and maintain them on the orginal files, too
  • Beta state ;-)

Sorry for posting here, but the anti spam system doesn't allow me to
create a new topic and the mail adress for whitelisting requests isn't working at all.

Greats Daniel

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2013-07-05 14:58

nerve2,
Thanks for your contribution! I have created a codex page: http://codex.galleryproject.org/Gallery3:Modules:epsupload#Notes please feel free to edit as needed.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
bzsolt

Joined: 2007-04-01
Posts: 43
Posted: Sat, 2013-07-06 09:30

HI Guys, that's great! Keep up the good work!

 
alivin70

Joined: 2013-04-03
Posts: 13
Posted: Tue, 2013-07-09 12:43

Hi Nerve2,
great job!

I'm working on a plugin for Ai and Psd.
And also on replacing and versioning of files.

What do you think about merging in one plugin the support for Tiff, Raw, Eps, Pdf, Ai and Psd?
With replacing and versioning it could be a simple DAM (Digital Assets Management) module for Gallery.

 
alivin70

Joined: 2013-04-03
Posts: 13
Posted: Wed, 2013-07-17 12:50

UPDATE

I've added the replacing and versioning of files.
The module is (back) in Alpha state, It's almost a different plugin because many things changed in the storage of files.
The TIFF images are now stored in the var/album directory, togheter with revised files.
The uploaded files are renamed with a _rev{number} suffix and their data stored in a DB table called {dam_revisions}.
On each image there is a block with list of revision and link to replace the file.

To install the module, unpack it and install/upgrade as usual.
Then go to Admin->Appearance->manage Sidebar and activate Revision List.

Then, to let it work you have to remove .htaccess from
var/albums
var/resizes
var/thumbs
I know it's a big issue for security, but I didn't understand yet how to say to kohana to let an authenticated user to see the files.

In version 4.1 I added a modified File Proxy controller named dam_proxy.php
You have t manually change the file
var/albums/.htaccess
and substitute in the line:
RewriteRule (.*) /gallery/index.php?kohana_uri=/file_proxy/$1 [L]
"file_proxy" with "dam_proxy".

You can find a sample .htaccess file in the zip.

An existing issue is album moving/renaming, so I disabled Album editing. And I suggest to disable Organize module to avoid inconsistencies.

Upgrading from previous version works on JPG file but not on TIFF, due to change in storage. A migration function is needed, but I develop for a clean environment ;)

I'm working on integrating other file formats (raw, pdf, eps, etc). Any help and suggestions are welcome.
After thet the module will be renamed from Tiffupload to DAM

Use this module for testing and development, NOT IN PRODUCTION. Use it at your own risk!

 
nerve2

Joined: 2013-06-25
Posts: 4
Posted: Thu, 2013-07-18 11:40

Hello Alvin,

i have made a simple change to tiffupload_v2, i have added support to copy over the exiv data from tiff to the jpg, if exiv2 is installed.
Sorry, i have develped then seen that you have also developed.
==> only changes i function tiffupload_graphics::convert, so feel free to port this lines to the new release of the plugin ...

I think i'ts a good idea to merge the filetypes eps, tif etc to one plugin ...
but revisions of a file shold be a standalone plugin ...( evtl. not every user wan't both functions ,,,)

Thank's for your work !
Daniel

 
alivin70

Joined: 2013-04-03
Posts: 13
Posted: Sun, 2013-08-18 15:06

Hallo Daniel,
thank you for the contribution to the code.
I ported your change to version 4 and uploaded a new zip named v4.2

I agree that revisions and support to filetypes are 2 different features, but instead of different plugins I would add configuration options inside the plugin.

Thank you again!

Vincenzo

 
alivin70

Joined: 2013-04-03
Posts: 13
Posted: Tue, 2014-02-25 09:27

Hi jamescmc,
the question is: how to manage multipage TIFF?
Splitting the original file in multiple file, each one with its own thumbnail?
Or mantaininig a single file, compositing all pages in the thumbnail?

Anyway I found the relevant commands in Imagemagick:
You can return the number of pages in a tiff using

identify -format "%p" multipage.tif

The command

convert multiple.tif single%d.tif 

splits the file in single images.

In my case TIFFs are simply stored in Gallery, I don't need multipage management.
If you want to patch the code you're welcome!

 
aba1051

Joined: 2008-12-07
Posts: 3
Posted: Mon, 2014-07-07 21:53

Hi,

I'm using tiffupload 4.3 with gallery 3.0.9. When tiffupload module is enabled in modules, I lost possibility to rotate image. When disabled, I can rotate images again. Do you have any idea, what can be wrong? I tried to search in rawphoto module forum too, but with no success.

Thanks

Petr