SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Feb 2014
    Location
    Hong Kong
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow 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:

    Code:
    "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?
    oXp1X.jpg

    Many thanks.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,601
    Mentioned
    411 Post(s)
    Tagged
    7 Thread(s)
    Why not just crop it yourself in Photoshop?

  3. #3
    SitePoint Member
    Join Date
    Feb 2014
    Location
    Hong Kong
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    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...

  4. #4
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,195
    Mentioned
    71 Post(s)
    Tagged
    3 Thread(s)
    You could do it with Imagemagick and probably Imagick:
    PHP Code:
    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.

  5. #5
    SitePoint Member
    Join Date
    Feb 2014
    Location
    Hong Kong
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Rubble View Post
    You could do it with Imagemagick and probably Imagick:
    PHP Code:
    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.

  6. #6
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,601
    Mentioned
    411 Post(s)
    Tagged
    7 Thread(s)
    Quote Originally Posted by TomChiang View Post
    i am finding the way to solve this problem using CSS...
    You could perhaps play around with the CSS clip property.

  7. #7
    SitePoint Member
    Join Date
    Feb 2014
    Location
    Hong Kong
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    You could perhaps play around with the CSS clip property.
    Yeah, thanks ~

    I will take a look


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •