Facebook cropped cover photo

Hi,

I want to get the Facebook Cover Photo on my website.
Which should be 850x315 pixels, but not the full image that I uploaded.

I can get image from Facebook, for example:


"cover": {
    "cover_id": "10152513030211729",
    "source": "https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-ash3/t1/s720x720/12714_10152513030211729_1664524928_n.jpg",
    "offset_y": 62,
    "offset_x": 0
}

Where “source” is the full image.
I would like to ask, how can I get exactly the cropped image shown in Facebook like this?

Many thanks.

1 Like

Why not just crop it yourself in Photoshop?

Because I have a list of Facebook shops,
Hence I need a dynamic way to show the photo…

You could do it with Imagemagick and probably Imagick:


exec("convert https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-ash3/t1/s720x720/12714_10152513030211729_1664524928_n.jpg -crop 850x315+0+62 output.jpg");

Ah just noticed there might be a problem with the https instead of http.

This is a good tool… Thanks for your reply.

However, i am finding the way to solve this problem using CSS…
Because i want to handle it through Web directly,but not save it in file system…
Thanks again.

1 Like

You could perhaps play around with the CSS clip property.

Yeah, thanks ~

I will take a look :slight_smile: