WordPress.org

Ready to get started?Download WordPress

Forums

Integrate images into content with the_post_thumbail (1 post)

  1. Jeremy Herve
    Member
    Posted 4 years ago #

    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:
    http://pastebin.com/7Hkzs6tU

    Thank you all!!

Topic Closed

This topic has been closed to new replies.

About this Topic