コード例 #1
0
<?php

use Podlove\Model\Image;
use Symfony\Component\Yaml\Yaml;
use Podlove\Cache\HttpHeaderValidator;
/**
 * WP Cron: Download Image URL
 */
add_action('podlove_download_image_source', function ($source_url, $file_name) {
    $image = new Image($source_url, $file_name);
    $image->download_source();
}, 10, 2);
/**
 * WP Cron: Resize Image
 */
add_action('podlove_download_image_resize', function ($source_url, $file_name, $width, $height, $crop) {
    (new Image($source_url, $file_name))->setWidth($width)->setHeight($height)->setCrop($crop)->generate_resized_copy();
}, 10, 5);
/**
 * WP Cron: Image cache validation
 */
add_action('wp', function () {
    if (!wp_next_scheduled('podlove_validate_image_cache')) {
        wp_schedule_event(time(), 'daily', 'podlove_validate_image_cache');
    }
});
add_action('podlove_validate_image_cache', 'podlove_validate_image_cache');
add_action('podlove_refetch_cached_image', 'podlove_refetch_cached_image', 10, 2);
function podlove_validate_image_cache()
{
    set_time_limit(5 * MINUTE_IN_SECONDS);