Quantcast
Channel: Recent Discussions on osTicket Forums
Viewing all articles
Browse latest Browse all 7550

[MOD] Inline PDF

$
0
0
So, I've finally upgraded, and wanted to restore my previews mod, but didn't want to have to generate preview images again.. that was horrible and sometimes didn't work. 

This time, I've spent a few hours figuring out the plugin interfaces.. and generally failing to figure them out. :-(

Got it to work anyway. 


image

Basically, it takes PDF's or Images and embeds them in the thread entries responsible for uploading them. Without modifying core! :D My best mod yet. The PDF is fully scrollable/rotatable/printable etc, the links are preserved should you need to download them. Images are linked to the full image and are not rotated etc, the PDF rendering is fully standard browser dependant etc..  Tested with Firefox/Chrome/IE11, not successful on IE11.. can't figure out why, as browser is broken. Added a message about the browser sucking and providing the normal link.. This also happens in Opera if you don't have a PDF plugin.

It's pretty simple, the bulk of the work is done in javascript, which get's injected into the footer. Tested and works on 1.8-git. SHOULD work on future versions, depending on how the files are attached.. haven't tested on anything else though, let me know! This means it gracefully falls back to complete stock by disabling javascript, and the plugin is self-contained, so ZERO MODS to core are required. You simply clone the repo or download the zip from github and extract into /includes/plugins/ which should make a folder: "pdf_preview", but it could be called anything. 

Current features:
  • PDF Files attached to a thread entry (note/message/reply etc) are embedded as full PDF objects in the entry.
  • Images attached to a thread entry are inserted as normal <img> tags.
  • png
  • jpg
  • gif
  • svg
  • bmp
Text files attached to a thread entry are fetched via AJAX and inserted into the thread entry using <pre> (If enabled). HTML files are also fetched via AJAX and inserted (If enabled). Detects pjax and falls back to stock jQuery if not found.
Message me if you want more features, I'm thinking of adding a "Tick the box extension selection" or something to pick what to display.

TODO:
  • Extrude CSS into file
  • Add admin options for file-types
  • Maybe modify the output in PHP rather than JS.. haven't decided, see what people say. This is working for now.

Viewing all articles
Browse latest Browse all 7550

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>