I load external feeds and i show thumbnails from external links.

I have big problem with Google PageInsight.

Pageinsight Result

Images are not in my server, they are links from feeds. How can I compress those images from feed ?

3 Answers 3


Actually darol100 is right. Since images are not on your server you cannot compress them. But you are able to cache them localy with image cache.

See this article here https://www.drupal.org/node/251009

  • Just did it. From 55% i have 80% in google pageinsight. I downloaded imagecache_external module, i added jusr 3 lines of code (in module page you can find the code and instructions) behind and it works! Ty! eyxaristw megale!
    – George J
    Jan 8, 2016 at 11:07

How do i compress external images?

That is impossible.

You could get the image into your server compressed and the server the image from your server but you cannot compress an external image.

  • What about converting external image to base64 and save it to Feed Item Field? I think this is the easiest way for me. Because the external_image comes from feed. I parse feed item, i search for first image and i take the href. Idk how to make it download.
    – George J
    Jan 8, 2016 at 8:35
  • That will be another discussion, on how to do it. Check the feed module, it might help you to download the images. I'm not sure... Jan 8, 2016 at 8:37

It is possible in some cases to compress external images with Drupal.

There are third-party services, like Imgix, that will compress/resize images on the fly. Typically, these come from an S3 bucket, but some also work from arbitrary URLs. In the case of arbitrary, external URLs, there is usually an authentication method to ensure you have permission to alter the images.

To use these, there are a few options. One would be to use a hook_url_outbound_alter() to rewrite the URL to use the third-party service. This is how the CDN module serves up images from an edge cache.

For images added to textfields (eg, images inserted into the body), you would use the Filter API to rewrite the URL to use your third-party service, and then add the filter to your input formats.

And lastly, if your external image is in a field by itself, you can simply write a field formatter to use the third-party service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.