• I was wondering if there is a way as how the default image upload system in WordPress can be integrated with Imgur hosting service. In short, if a user uploads an image via the WordPress system the image would get uploaded to Imgur instead of the WordPress “wp-content/uploads” folder.
    Already something like this exists for AWS S3/Google Cloud where the uploads move into AWS instead of WP so why not use Imgur for this purpose.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator bcworkz

    (@bcworkz)

    It would depend on what sort of API Imgur provides for developers. I know The Goog is usually pretty good at providing decent APIs. Imgur, I’ve no idea. You’d have to poke around their site to see if anything is available.

    WP has all the resources of PHP, jQuery and javascript available. There’s no question that WP can send something out. Can Imgur receive it? If so, setting the <img> src attribute in a post to point to an Imgur resource is fairly simple.

    Thread Starter Sandeep Tripathy

    (@sandeeptripathy)

    Hi bcworkz
    I tried looking into the Imgur API and found out that its actually really simple to use and upload. In fact it supports PHP and you can have a look at a tutorial published here, the demo of which is available here.
    As I know it takes 2-3 mins to get this working, the only place I am stuck at is the upload procedure of WordPress. Once I get to know how it is handled I may be able to override it with the Imgur API to make it working.

    Hi,

    you can do this like the media-instagram plugin. You can access the sources here: https://vanillaco.de/file.php?name=%2Fmedia-instagram%2Ftrunk%2Fmedia-instagram.php . You only have to replace the instagram api by the imgur api.

    Regards
    Michael

    Thread Starter Sandeep Tripathy

    (@sandeeptripathy)

    Hi Michael,
    I’m not exactly looking for extracting mages. I want to upload directly into Imgur using its API using the WordPress functions. Its basically I want to override the WordPress upload function with Imgur API so that every image uploaded gets uploaded into Imgur instead of the WP server.

    Moderator bcworkz

    (@bcworkz)

    I think the best strategy would be to let WP do it’s uploads, then move the images off to Imgur. The function that handles uploads is _wp_handle_upload(). It has a filter called ‘wp_handle_upload’ (line 374) where this could be accomplished.

    Even better, it appears you can replace the local file URL with the Imgur URL in this filter, and the correct URL will propagate into the post and attachment data fields. Completely untested, but this appears to be a one stop hack ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Any Way To Integrate Imgur with WordPress Image Upload System’ is closed to new replies.