function wpthumb_watermark_add_args_to_post_image($args, $id)
{
    if (wpthumb_wm_image_has_watermark($id)) {
        $args['watermark_options'] = wpthumb_wm_get_options($id);
    }
    return $args;
}
Ejemplo n.º 2
0
 function _show_watermark_on_image_downsize($return, $id, $size)
 {
     $options = wpthumb_wm_get_options($id);
     $options['pre_resize'] = true;
     if (is_array($size) && key($size) === 0) {
         $size = array('width' => $size[0], 'height' => $size[1]);
     } else {
         $size = wp_parse_args($size);
     }
     $size['watermark_options'] = $options;
     return array(wpthumb(get_attached_file($id), $size));
 }
Ejemplo n.º 3
0
function hm_get_post_image($post = null, $w = 0, $h = 0, $crop = false, $id = null, $default = null)
{
    if ($post === null) {
        global $post;
    }
    // stop images with no post_id slipping in
    if ($post->ID == 0 && !$id) {
        return;
    }
    $id = $id ? $id : hm_get_post_image_id($post);
    if ($id) {
        return wpthumb(get_attached_file($id), $w, $h, $crop, true, wpthumb_wm_get_options($id));
    }
    $att_id = hm_get_post_attached_image_id($post);
    if ($att_id) {
        return wpthumb(get_attached_file($att_id), $w, $h, $crop, true, wpthumb_wm_get_options($id));
    }
    //if there is no id, then try search the content for an image
    if ($return = wpthumb(hm_get_post_internal_image($post), $w, $h, $crop, true, wpthumb_wm_get_options($id))) {
        return $return;
    }
    if ($return = hm_get_post_external_image($post)) {
        return $return;
    }
    if ($default) {
        $file = $default === 'default' ? dirname(__FILE__) . '/includes/image-unavailable.png' : $default;
        return wpthumb($file, $w, $h, $crop, true);
    }
}