Support » Fixing WordPress » Integrate images into content with the_post_thumbail

  • I have a bit of challenge to solve with WordPress these days; and I was wondering if some of you had already met with that situation.

    I receive content via an API and would like to publish it on a blog with WordPress. So far ok, thanks to a WordPress plugin provided by the company producing the content, all the content can be imported, added, post publication is managed as well.

    What is tricky to solve is the image integration: here is how it is managed so far:
    $post_image = $image->getUrl();

    if($post_image != ""){
          $post_content = '<img src="'.$post_image.'" alt="'.$post_image_caption.'" align="right">'.$post_content;

    The URL of the image is got from the API and then is integrated before the content.

    What I would like to do is to download that image to my servers, to host it myself instead of on the content provider’s, and then integrate it into my articles through the the_post_thumbnail function, so that the image gets resized into different sizes (I have 2 different sizes for thumbnails, for the homepage and single.php, that I manage pretty well with the_post_thumbnail today)

    Do you think that’s possible? Can you help?

    I pasted the code of the plugin they provide:

    Thank you all!!

  • The topic ‘Integrate images into content with the_post_thumbail’ is closed to new replies.