!!! If someone can answer this now, I will wait until the end of the reward period and until 150 before his reward. (Scouts honor!) !!!
I looked around, but I can not find the answer to this question:
I get event cover images from fb api and also save offset_x and offset_y values. Then I put the images as css background-images as follows:
CSS
.event-image {
margin-bottom: 30px;
width: auto;
width: 500px;
height: 178px;
max-width: 100%;
min-width: 300px;
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
outline: none;
}
Height / Width is based on the exact ratio used by facebook: 2.8: 1
HTML
<div class="event-image" style="background-image: url([url of img]); background-position: [offset_x]% [offset_y]%;" >
(I have some internal logic that only adds the background-position property if there is one set in fb api.)
The problem is that it only works 90% of the time. About 10% of the images are slightly aligned. usually only a few percentage points: - (
Here is an example.
.event-image {
margin-bottom: 30px;
width: auto;
width: 500px;
height: 178px;
max-width: 100%;
min-width: 300px;
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
outline: none;
}
<div class="event-image" style="background-image: url(https://scontent.xx.fbcdn.net/t31.0-0/p180x540/14566476_1295215523823549_1334771895810946224_o.jpg); background-position: 0% 50%; "> </div>
Run codeHide result
, 46% - fb 50%?
, , , , .
, :
fb, offset_x fb -7px, api, offset_x = 50%
{
"cover": {
"offset_x": 50,
"offset_y": 0,
"source": "https://scontent.xx.fbcdn.net/t31.0-8/s720x720/14681104_1307094859330152_7540791723420117074_o.jpg",
"id": "1307094859330152"
},
"id": "544220282434185"
}
, 500px (width of my image) * offset_x % = 250px
: -)
, , , 1800. fb, 0 100.