Hello,

I am unable to fetch and display images in my wordpress blogs as its shortlinked by IFTTT in format "http://ift.tt/22lveRw", can someone please help me out with this, the follow code does fetch the image if its in normal format i.e "http://i.imgur.com/Z2aGVEl.png", what changes do i need to make the following code to make it work with ifttt format?

Please help.

function catch_that_image() {
  global $post, $posts;
  $first_img = '';
  ob_start();
  ob_end_clean();
  $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
  $first_img = $matches[1][0];

  if(empty($first_img)) {
    $first_img = "/path/to/default.png";
  }
  return $first_img;
}

Recommended Answers

Did you try unchecking the box noted at https://michaelsoolee.com/ifttt-links

Jump to Post

If that fixed it, good news. I'm just looking into IFTTT so questions like this help be learn more.

Jump to Post

All 5 Replies

@rproffitt : You are Awesome!! I didn't even knew that option exist :P
Done! Unchecked it, I think this is gonna make my like so much easier :)

If that fixed it, good news. I'm just looking into IFTTT so questions like this help be learn more.

Yes, that fixed my issue :)

For the archives, if the above link dies it wrote "login, go to Preferences > Settings. Then scroll down until you see URL Shortening. You should see a checkbox checked with Auto shorten URLs. Simply uncheck this and update your settings."

Tameat614, if you mark this solved for others to know it's complete.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.