Finding the resize for an album thumb

undagiga

Joined: 2010-11-26
Posts: 693
Posted: Tue, 2013-10-29 11:37

I suspect this can't be done, but I thought I'd ask anyway. In the Facebook Like module there's a meta tag used that tells facebook what image to use to represent the current page, be it photo or album. The code used to specify the image is
$item->thumb_url(true)
which for an album produces a URL like
<meta property="og:image" content="http://mysite.com/var/thumbs/myalbum/.album.jpg?m=1325643058"/>
and for a resize page
<meta property="og:image" content="http://mysite.com/var/thumbs/myalbum/myimage.jpg?m=1382664954"/>

The problem with this is that FB thinks the thumb is too small. Now for the resize page I could instead use
$item->resize_url(true)
And while this works on a resize page, it breaks on an album page because it results in
<meta property="og:image" content="http://mysite.com/var/resizes/myalbum/.album.jpg?m=0"/>
and the .album.jpg file doesn't exist in the resizes tree, plus m=0.

So my question is, is there any way to find the resize image that corresponds to an album thumb? The only thing I could think of is if the m=1325643058 parameter in the second code snippet above somehow could be used to find the resize image. What does m mean?

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Tue, 2013-10-29 12:11

I doubt the image size is your issue. From Facebook:

Quote:
We suggest that you give us an image of at least 600x315 pixels. However, bigger is better, so if you have a 1200x630 or larger image that you can use, please give it to us. Also, we recommend that you keep images as close to a 1.91:1 aspect ratio as possible to avoid cropping. (Note: image sizes must be no more than 5MB in size.)

But the images I sometimes use are way less than even half of the recommended 600x315 and they work as expected. (There's a new display format, though, that is used if you provide a larger image.)

undagiga wrote:
while this works on a resize page, it breaks on an album page

That's because the "album" isn't a real item and, therefore, doesn't have a resize. If you are convinced this is the issue, you'd likely have to modify G3 core to create a resize version of album highlights, or do a db query (or two) to find the resize version of the highlight image. Could be done, but I'm thinking this actually isn't your issue--unless maybe your thumbs are less than 100px.

If you're doing the db query, first get the album_cover_item_id, then use that to get the path to the resize image.

undagiga wrote:
The only thing I could think of is if the m=1325643058 parameter in the second code snippet above somehow could be used to find the resize image

Nope. Won't work that way. That's just to assist with caching issues.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2013-10-29 22:29
topic wrote:
Finding the resize for an album thumb

Quote:
So my question is, is there any way to find the resize image that corresponds to an album thumb?

There is not resize for album thumbs. There is a album highlight.
I suspect that one would have to do a DB look-up with a table join as well. I'm not 100% sure it could be done.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Wed, 2013-10-30 08:45

Thanks. I understand why there's no album image in the resize folder. The question is what can be done about it.

I'm using the Greydragon theme and thumbs are 200px. I'm not so concerned about the FB debugger complaining as what happens when someone likes an album. FB grabs the thumb and it isn't all that good a look because FB rescales it up.

To make matters more complicated, I sometimes use the Album Cover Browser module to set the thumb, which would make the task of finding the resize even more difficult.

I guess I could hack the code that produces the album thumbs to also create another larger one in resize folder, but that would mean going and regenerating all the existing thumbs. Which is what tempg was suggesting I think. I like my chances of doing that more than I do DB queries, look-ups and joins (whatever they are).

I'll think about this some more. Thanks for the comments

p.s. If I did generate an album resize image, how do I set m equal to something other than zero? Or would that problem solve itself if http://mysite.com/var/resizes/myalbum/.album.jpg actually existed?

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Wed, 2013-10-30 10:55

Again, if your thumbs are 200px, FB should have no problem with them; FB does not scale up unless you've got something else going on. (This is from experience with the Galleries I use; the images FB uses are smaller than 200px on each side, but I have no issues.)

The FB debugger is notoriously buggy, so you're right to ignore it for some things.

Using the album cover browser would have no effect on finding the resize of the highlight.

I would put more time into this, but I don't think it'll be very useful; as stated above, I don't think this is the issue (and I'm not sure that I fully get whatever's going on). Maybe a screenshot of the issue? Does the same thing happen when someone likes the page as when someone shares a link directly on their FB timeline?

As for the "m=" query string, there was one report of issues with video, but nothing like that for photos--and you don't need it added to anything unless caching is an issue.
http://galleryproject.org/node/112019

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Wed, 2013-10-30 14:42

I'd need to check again, but I think that something doesn't look quite right if the like button inserted by the FB module is used on an album page. Links shared directly on the timeline don't seem as bad, although it's still just a thumb. Stay tuned - need to test.

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Wed, 2013-10-30 14:59
undagiga wrote:
FB grabs the thumb and it isn't all that good a look because FB rescales it up.

undagiga wrote:
Links shared directly on the timeline don't seem as bad, although it's still just a thumb

Those are two separate things.
If the images/links appear wrong ("bad") or stretched ("FB rescales it up"), that's one thing. If it's "just a thumb," that's something different (and expected). A screenshot would help to see what's going on (or not).