コード例 #1
0
ファイル: feature.php プロジェクト: natepixel/reason_package
	function get_av_info($media_works_id)
	{
		$width=$this->params['width'];
		$height=$this->params['height'];
		$fh= new Feature_Helper();
		$av_info=$fh->get_av_info($media_works_id,$width,$height);
		return $av_info;
	}
コード例 #2
0
ファイル: feature.php プロジェクト: hunter2814/reason_package
 function init_avs()
 {
     //now get an av, if it exists
     $fh = new Feature_Helper();
     $id = $this->get_value('id');
     $av_ids = null;
     $results_array = $fh->get_avs_associated_with_feature($id);
     if (!empty($results_array)) {
         foreach ($results_array as $r) {
             $tmp = $r->get_value('av_id');
             if (is_array($tmp)) {
                 $av_ids = $tmp;
             } else {
                 if ($tmp != "none") {
                     $av_ids = array(0 => $tmp);
                 } else {
                     $av_ids = array(0 => "none");
                 }
             }
         }
     } else {
         $av_ids = array(0 => "none");
     }
     $this->av_ids = $av_ids;
     $av_html = array();
     $av_img_url = array();
     $av_img_alt = array();
     $av_thumbnail_urls = array();
     $av_img_ids = array();
     $av_types = array();
     foreach ($av_ids as $id) {
         if ($id != "none") {
             $av_info = $fh->get_av_info($id, $this->width, $this->height);
             $av_html[] = htmlspecialchars($av_info['av_html'], ENT_QUOTES);
             $av_img_url[] = $av_info['av_img_url'];
             $av_img_alt[] = $av_info['av_img_alt'];
             if ($av_info['av_img_id'] != "none") {
                 $av_thumbnail_urls[] = reason_get_image_url($av_info['av_img_id'], 'thumbnail');
                 $av_img_ids[] = $av_info['av_img_id'];
             } else {
                 $av_thumbnail_urls[] = $av_info['av_img_url'];
                 $av_img_ids[] = "none";
             }
             $av_types[] = $av_info['type'];
             //pray($av_info);
         } else {
             $av_img_url[] = "none";
             $av_img_alt[] = "";
             $av_thumbnail_urls[] = "none";
             $av_img_ids[] = "none";
             $av_types[] = "none";
         }
     }
     $this->av_image_urls = $av_img_url;
     $this->av_image_alts = $av_img_alt;
     $this->av_thumbnail_urls = $av_thumbnail_urls;
     $this->av_img_ids = $av_img_ids;
     $this->av_types = $av_types;
 }
コード例 #3
0
function resize_av_images($image_id_str)
{
    global $d;
    $img_ids = explode(",", $image_id_str);
    $types = explode(",", $d['av_type']);
    $width = (int) $d['w'];
    $height = (int) $d['h'];
    $crop_style = $d['crop_style'];
    $url = array();
    $fh = new Feature_Helper();
    $curr = 0;
    foreach ($img_ids as $id) {
        if ($id != "none") {
            $rsi = new reasonSizedImage();
            $rsi->set_id($id);
            $rsi->set_width($width);
            $rsi->set_height($height);
            $rsi->set_crop_style($crop_style);
            $watermark = $fh->get_watermark_absolute_path($types[$curr]);
            //$options=array('horizontal'=>'center','vertical'=>'center');
            $options = array();
            $options['horizontal'] = "center";
            $options['vertical'] = "center";
            $rsi->set_blit($watermark, $options);
            //			$rsi->_make();
            $url[] = $rsi->get_url();
            //			$path=$rsi->get_file_system_path_and_file_of_dest();
            //			blit_image($path,$path,$watermark,$options);
            $curr++;
        }
    }
    $str = "";
    for ($i = 0; $i < count($url); $i++) {
        $str .= "" . $url[$i] . ",";
    }
    $str = trim($str, ",");
    return $str;
}