This creates an almost full-size preview of attached PDF's and then inserts them into the HTML of the ticket thread as a JPG, for Staff only.
It also generates a little jQuery script for the image so staff can rotate it 180 degrees.. because Faxes.. damn machines still get users confused and they sometimes send them upside down. This lets the image-preview rotate 180 degrees.
Dunno if anyone but me would find it useful, let me know what you think.
Requirements:( ImageMagick) on the server, php-imagick not required. Currently works only on Linux, might be easy to rewrite for Windows, don't have one to try.
Installation:
Edit scp.css add: (just right at the bottom is fine)
.rotated {
filter: progid.Microsoft.BasicImage(rotation=2);
-moz-transform: rotate(180deg);
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
transform: rotate(180deg);
}
Save attachments_thumbnailer.php into /include/
Edit include/class.thread.php: (Round line 458)
function getAttachmentsLinks($file = 'attachment.php', $target =
...
$size = sprintf('<em>(%s)</em>', Format :: file_size($attachment));
include('attachments_thumbnailer.php'); //___________________________add this line here___________________________________
$str .= sprintf('<a class="Icon file"...
Edit attachments_thumbnailer.php and choose your settings.
At the very least, you will need to set the Base URL, change 'http://your-domain-name.com/support/scp'; into whatever your scp base URL is.
You can also adjust the image quality by modifying the $imageMagickCommand, read (more here)
$showInLogs = false; Change to true to show actions performed in the apache error logs.
Works on attachments saved in your database, until the API is changed!
To ensure your hard-drive isn't exhausted by doubling up with a preview of all these thumbnails, simply create a crontask that will empty old attachments from the folder:
find /path/to/scp/restricted -type f -mtime +7 -delete
Users rarely need old attachments, and it will simply regenerate as required anyway!
[attachments_thumbnailer.php.zip](https://forum.osticket.com/assets/files/migrated/1/c5e21fc40fcdb8ca94c27eb9f8faadf.zip)