Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Dan Rossiter

    (@danrossiter)

    Hi ihaider,

    This could be done, but since external PDFs can’t be WordPress attachments, you would need to put together some custom code to integrate with DG.

    If this is something you or your team is interested in pursuing I can give you some more detailed pointers.

    -Dan

    Thread Starter The Choice

    (@ihaider)

    Thanks Dan for your reply,

    If it wouldn’t require too much coding, we would be interested in using DG for external hosted pdf files. Awaiting details.

    Thanks,

    -The Choice

    Plugin Author Dan Rossiter

    (@danrossiter)

    ihaider,

    I’ve done some more research on this topic, and unfortunately it will not be as easy as I had hoped. It’s not impossible, I don’t believe, but it’s going to be a pain. The following is very high level framework of what would need to happen in order for DG to support processing remote files.

    • Everything in the DG logic relies on WP attachments. Even if you bypassed this, most of the thumbnail generation methods (including IMagick & Ghostscript — the two thumbnail generation methods other than Thumber.co that support PDF processing) require a local file in order to generate a thumbnail.
    • Supporting “remote attachments” in WP should be possible, though it looks like no plugin adding this functionality has been developed (at least, not that I could find). If you wanted to do this, you would want to look closely at the logic starting under WordPress’ wp-admin/media-new.php. Throughout the process of creating a new attachment, there are numerous places behavior can be overridden, starting with wp_handle_upload_prefilter. The changes would require handling the backend logic and also exposing a way to “upload” remote files, where uploading would probably just be passing a URL to be referenced as the file location without anything ever being downloaded to the server.

    The other option, which is probably less involved, but would require re-implementing most of DG logic for displaying galleries of files, would be to copy the logic from class-ghostscript-thumber.php in the getThumbnail method and adapting it to handle remote files (downloading the remote file long enough to generate a thumbnail, then removing the temp file once a thumbnail has been generated).

    I will tell you, the concept of true “remote attachments” and piqued my interest. Depending on my availability, I may poke at implementing a plugin to provide support for this as it seems like a very useful feature, but I can’t make any promises that I’ll 1) find the time to tackle this and 2) that even if I do find the time, I find a way to make it all work.

    All of that said, if you do decide to implement remote attachment support, I will commit to updating DG to support remote attachments.

    Please do let me know what you decide on. And I’m sorry I couldn’t give you better news.

    -Dan

    • This reply was modified 7 years, 11 months ago by Dan Rossiter.
    Thread Starter The Choice

    (@ihaider)

    Hi Dan,

    Thank you for your detailed reply. I truly appreciate your time and efforts. I suppose, for the time being, I’ll utilize the plugin as is with the built-in features. I am looking forward to seeing what you come up with in the future.

    Thank you again.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘External (hosted) PDF files’ is closed to new replies.