Esempio n. 1
0
            <?php 
    /* ?>
    			<br>
    			<div class="btn-red">IM LIVE</div>
                <?php */
    ?>
		</div>
	</article>
	<?php 
    //echo $GLOBALS['post_type_promo']->getPromoBlock(null, 3, ' promotions-single');
    ?>
	<div class="promotions-section promotions-s-form">
		<div class="holder">
			<div class="promo promo-wide">
				<?php 
    $email_form_box = new EmailFormBox(get_the_ID());
    $image = $email_form_box->getImageURL();
    ?>
				<a href="<?php 
    echo $image[1];
    ?>
" onclick="addTrackEvent('<?php 
    echo $post->post_name;
    ?>
')"><img src="<?php 
    echo $image[0];
    ?>
" alt=""></a>
			</div>
			<div class="promo promo-form" rel="<?php 
    echo $post->post_name;
Esempio n. 2
0
 /**
  * Get thumbnail image
  * @param  string  $src  --- image url
  * @param  integer $w    --- width
  * @param  integer $h    --- height
  * @param  integer $q    --- quality
  * @param  boolean $crop --- crop or no
  * @return string        --- thumbnail url
  */
 public static function getImageThumb($src, $w = 600, $h = 250, $q = 95, $crop = true)
 {
     $thumb_url = $src;
     $ext = EmailFormBox::getExtension($src);
     if (!$ext) {
         return $thumb_url;
     }
     $cache = md5($src . "{$w}-{$h}-{$q}-{$crop}-gc");
     $uploads = wp_upload_dir();
     $cache_dir = $uploads["basedir"] . "/2014/00";
     $thumb_url = $uploads["baseurl"] . "/2014/00/{$cache}.{$ext}";
     $thumb_dir = $cache_dir;
     $thumb_file = $thumb_dir . "/{$cache}.{$ext}";
     if (!dir($cache_dir)) {
         mkdir($cache_dir, 0744, true);
     }
     if (!is_file($thumb_file)) {
         $editor = wp_get_image_editor($src);
         if (!is_wp_error($editor)) {
             $editor->resize($w, $h, $crop);
             $editor->set_quality($q);
             $editor->save($thumb_file);
         } else {
             $thumb_url = $src;
         }
     }
     return $thumb_url;
 }