🚨 rethumb will shutdown on September 4th, 2021 🚨 (Twitter)

<< More Tutorials

How to resize an image to cover any dimensions in PHP using rethumb?

To resize an image, with our "cover" operation, in PHP use the following code:

    $param_operation = "cover";
    $param_value = "150x200"; // New WIDTHxHEIGHT in pixels.
    $image_url = "http://images.rethumb.com/image_coimbra_600x300.jpg";
    $image_filename = "resized-image.jpg";

    file_put_contents($image_filename, file_get_contents("http://api.rethumb.com/v1/$param_operation/$param_value/$image_url"));

Start using this example now

Use the following commands to get started:

$ git clone https://github.com/rethumb/rethumb-php-examples.git
$ cd rethumb-php-examples
$ php cover.php

More examples using PHP