1.4.10: Possible bug with og:image in html_meta_tags.php?

I started noticing some issues and it looks like it is related to the og:image or twitter:card option of html_meta_tags. I took a screenshot here: http://i.imgur.com/114cLk2.png

Browser is making these requests: http://i.imgur.com/U4uSLWx.png

Not on all album though.

If I uncheck og:image and twitter:card these odd requests do not occur.

If I uncomment this line in html_meta_tags.php:
`
case 'album.php':
$pagetitle = getBareAlbumTitle() . " - ";
$date = getAlbumDate();
$desc = getBareAlbumDesc();
$canonicalurl = $host . getPageNumURL($_zp_page);
if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
$thumbimg = $_zp_current_album->getAlbumThumbImage();
getMaxSpaceContainer($ogimage_width, $ogimage_height, $thumbimg, false);
//$thumb = $host . html_encode(pathurlencode($thumbimg->getCustomImage(NULL, $ogimage_width, $ogimage_height, NULL, NULL, NULL, NULL, false, NULL)));
}
break;
`
Then those requests do not occur.

Comments

  • I get it on the Image pages as well and it seems to happen if the image hasn't already been created (it's not in the cache). If I reload the page then those requests do not appear.
  • acrylian Administrator, Developer
    The code you cited generates just this:
    `/">`

    If the image is not already generated on that url the image processor is called. So this is probably the requests you got. As you know images are generated on request. The only way to avoid this is to register the sizes to the cacheManager and precache the images. Or set the sizes on the plugin options to sizes you already got. Probably the plugin should do this itself.
  • Yeah, normally I view every image to get the all of them into the cache. Going to try and duplicate what the single.php does within the theme.. For the moment this is working:
    `
    case 'album.php':
    $pagetitle = getBareAlbumTitle() . " - ";
    $date = getAlbumDate();
    $desc = getBareAlbumDesc();
    $canonicalurl = $host . getPageNumURL($_zp_page);
    if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
    $thumbimg = $_zp_current_album->getAlbumThumbImage();
    $mrh_thumb = $thumbimg->getFullImageURL();
    getMaxSpaceContainer($ogimage_width, $ogimage_height, $thumbimg, false);
    $mrh_thumb = str_replace('albums','cache',$mrh_thumb);
    $mrh_thumb = str_replace('.','_w520.',$mrh_thumb);
    $mrh_thumb = str_replace('.flv','.jpg',$mrh_thumb);
    $mrh_thumb = str_replace('.mp4','.jpg',$mrh_thumb);
    $mrh_thumb = html_encode(pathurlencode('http://'.$_SERVER['HTTP_HOST'].$mrh_thumb));
    $thumb = $mrh_thumb;

    //$thumb = $host . html_encode(pathurlencode($thumbimg->getCustomImage(NULL, 520, NULL, NULL, NULL, NULL, NULL, false, NULL)));
    //$thumb = $host . html_encode(pathurlencode($thumbimg->getCustomImageURL(NULL, 520)));
    }
    break;
    `
  • acrylian Administrator, Developer
    I think you are overcomplicating things a bit ;-) Once the generated image is cached all is allright. So this only happens once. The size setting (the defaults) of the plugin generally matches the requirements of the social media services regarding image sizes.

    The best would be still to let the plugin register the sizes to the cacheManager so you can pre-generate them if necessary.
  • LOL I know... I had a unique case where I intercept 404's to locate where an image has moved and I log various things concerning it... so my log had a bunch of stuff regarding these requests and I just wanted to stop them.

    In any event, it does seem that the plugin as-is does need some work. Never noticed it before because I had already created all the images. I'll see if I can register the size with the cacheManager.

    The theme has this:
    `
    if (class_exists('cacheManager')) {
    //$me = basename(dirname(__FILE__));
    $me = 'headgarland';
    cacheManager::deleteThemeCacheSizes($me);
    cacheManager::addThemeCacheSize($me, 520, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL, NULL);
    cacheManager::addThemeCacheSize($me, MRH_THUMBNAIL_SIZE, NULL, NULL, getThemeOption('thumb_crop_width'), getThemeOption('thumb_crop_height'), NULL, NULL, true, NULL, NULL, NULL);
    }
    `
    Guess something more than this is needed for the plugin.
  • acrylian Administrator, Developer
    Actually that is the same for plugins. Some like the slideshow plugins already do this. Different would be only the parameter for maxspace images. I will take care of that change sometime soon.
Sign In or Register to comment.