Changeset 2199314
- Timestamp:
- 11/23/2019 07:02:36 AM (5 years ago)
- Location:
- gallery-bank/trunk
- Files:
-
- 2 added
- 3 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
gallery-bank/trunk/includes/footer.php
r2191280 r2199314 709 709 } else if (video_url.match(/dailymotion\.com/i)) 710 710 { 711 embed_src = "http:// dailymotion.com/embed/video/" + video_url.split(/[_]/)[0].split("/")[4];711 embed_src = "http://dailymotion.com/embed/video/" + video_url.split(/[_]/)[0].split("/")[4]; 712 712 video_type = "dailymotion"; 713 713 } else if (video_url.match(/metacafe\.com\/watch/i)) … … 721 721 } else if (video_url.match(/flickr\.com(?!.+\/show\/)/i)) 722 722 { 723 embed_src = "http ://www.flickr.com/apps/video/stewart.swf?photo_id=" + video_url.split("/")[5];723 embed_src = "http://www.flickr.com/apps/video/stewart.swf?photo_id=" + video_url.split("/")[5]; 724 724 video_type = "flickr"; 725 725 } else if (video_url.match(/youku\.com/)) -
gallery-bank/trunk/lib/action-library.php
r2195382 r2199314 191 191 copy( $src_file, GALLERY_BANK_ORIGINAL_DIR . $file_name ); 192 192 copy( $src_file, GALLERY_BANK_UPLOAD_DIR . $file_name ); 193 } elseif ( function_exists( 'curl_init' ) ) {194 $src_file = wp_get_attachment_image_src( $attachment_file_id, '' );195 $obj_image_process_gallery_bank->copy_images_gallery_bank( $src_file[0], GALLERY_BANK_ORIGINAL_DIR . $file_name );196 $obj_image_process_gallery_bank->copy_images_gallery_bank( $src_file[0], GALLERY_BANK_UPLOAD_DIR . $file_name );197 193 } 198 194 $thumbnail_image_name = $obj_image_process_gallery_bank->create_thumbs_gallery_bank( $image_name, $image_data ); -
gallery-bank/trunk/lib/class-dbhelper-gallery-bank.php
r1832706 r2199314 136 136 $path = explode( '/', $url ); 137 137 $id = end( $path ); 138 $hash = maybe_unserialize( file_get_contents( "http://vimeo.com/api/v2/video/$id.php" ) ); // @codingStandardsIgnoreLine138 $hash = maybe_unserialize( ( "http://vimeo.com/api/v2/video/$id.php" ) ); // @codingStandardsIgnoreLine 139 139 $video_thumbnail_path = $hash[0]['thumbnail_medium']; 140 140 } elseif ( preg_match( '/dailymotion\.com/i', $url ) ) { 141 141 $path = explode( '/[_]/', $url ); 142 142 $id = explode( '/', $path[0] ); 143 $video_thumbnail_path = json_decode( file_get_contents( 'https://api.dailymotion.com/video/' . $id[4] . '?fields=thumbnail_medium_url' ) ); // @codingStandardsIgnoreLine 143 $video_thumbnail_path = wp_remote_get( 'https://api.dailymotion.com/video/' . $id[4] . '?fields=thumbnail_medium_url' ); // @codingStandardsIgnoreLine 144 $video_thumbnail_path = json_decode( $video_thumbnail_path['body'] ); 144 145 $video_thumbnail_path = $video_thumbnail_path->thumbnail_medium_url; 145 146 } elseif ( preg_match( '/metacafe\.com\/watch/i', $url ) ) { 146 147 $path = explode( '/', $url ); 147 $parse = file_get_contents( 'http://www.metacafe.com/embed/' . $path[4] . '/' . $path[5] ); // @codingStandardsIgnoreLine148 $parse = ( 'http://www.metacafe.com/embed/' . $path[4] . '/' . $path[5] ); // @codingStandardsIgnoreLine 148 149 preg_match_all( '/{(.*?)}/', $parse, $matches ); 149 150 $get_thumb = explode( '"', $matches[0][1] ); … … 160 161 } 161 162 } elseif ( preg_match( '/flickr\.com(?!.+\/show\/)/i', $url ) ) { 162 $get_video_info = file_get_contents( "http://www.flickr.com/services/oembed/?url={$url}&format=json" ); // @codingStandardsIgnoreLine163 $data = json_decode( $get_video_info , true );163 $get_video_info = ://www.flickr.com/services/oembed/?url={$url}&format=json" ); // @codingStandardsIgnoreLine 164 $data = json_decode( $get_video_info, true ); 164 165 $video_thumbnail_path = $data['thumbnail_url']; 165 166 } elseif ( preg_match( '/youku\.com/', $url ) ) { … … 194 195 * This function is used to copy images. 195 196 * 196 * @param string $src passes parameter as src.197 * @param string $destination passes parameter as destination.198 */199 public function copy_images_gallery_bank( $src, $destination ) {200 $ch = curl_init(); // @codingStandardsIgnoreLine201 curl_setopt( $ch, CURLOPT_URL, $src ); // @codingStandardsIgnoreLine202 curl_setopt( $ch, CURLOPT_HEADER, 0 ); // @codingStandardsIgnoreLine203 curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); // @codingStandardsIgnoreLine204 curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); // @codingStandardsIgnoreLine205 $data = curl_exec( $ch ); // @codingStandardsIgnoreLine206 curl_close( $ch ); // @codingStandardsIgnoreLine207 if ( $data ) {208 $fp = fopen( $destination, 'wb' ); // @codingStandardsIgnoreLine209 if ( $fp ) {210 fwrite( $fp, $data ); // @codingStandardsIgnoreLine211 fclose( $fp ); // @codingStandardsIgnoreLine212 } else {213 fclose( $fp ); // @codingStandardsIgnoreLine214 return false;215 }216 } else {217 return false;218 }219 }220 /**221 * This function is used to copy images.222 *223 197 * @param string $fname passes parameter as fname. 224 198 * @param string $image_data passes parameter as image_data. … … 265 239 } 266 240 /** 267 * This function is used to copy images.268 *269 * @param string $path passes parameter as path.270 * @param string $direction passes parameter as direction.271 */272 public function flip_image_gallery_bank( $path, $direction ) {273 if ( function_exists( 'wp_get_image_editor' ) ) {274 if ( 'horizontal' === $direction ) {275 $obj_img_flip = wp_get_image_editor( $path );276 $obj_img_flip->flip( false, true );277 $obj_img_flip->save( $path );278 } else {279 $obj_img_flip = wp_get_image_editor( $path );280 $obj_img_flip->flip( true, false );281 $obj_img_flip->save( $path );282 }283 } else {284 if ( function_exists( 'imageflip' ) ) {285 list($source_image_width, $source_image_height, $source_image_type) = getimagesize( $path );286 $source_gb_image = false;287 switch ( $source_image_type ) {288 case IMAGETYPE_GIF:289 $source_gb_image = imagecreatefromgif( $path );290 imagealphablending( $source_gb_image, false );291 imagesavealpha( $source_gb_image, true );292 break;293 case IMAGETYPE_JPEG:294 $source_gb_image = imagecreatefromjpeg( $path );295 break;296 case IMAGETYPE_PNG:297 $source_gb_image = imagecreatefrompng( $path );298 imagealphablending( $source_gb_image, false );299 imagesavealpha( $source_gb_image, true );300 break;301 }302 303 if ( 'vertical' === $direction ) {304 imageflip( $source_gb_image, IMG_FLIP_VERTICAL );305 } else {306 imageflip( $source_gb_image, IMG_FLIP_HORIZONTAL );307 }308 309 switch ( $source_image_type ) {310 case IMAGETYPE_GIF:311 imagegif( $source_gb_image, $path, 9 );312 break;313 case IMAGETYPE_JPEG:314 imagejpeg( $source_gb_image, $path, 100 );315 break;316 case IMAGETYPE_PNG:317 imagepng( $source_gb_image, $path, 9 );318 break;319 }320 imagedestroy( $source_gb_image );321 return true;322 }323 }324 }325 /**326 * This function is used to copy images.327 *328 * @param string $path passes parameter as path.329 * @param string $direction passes parameter as direction.330 */331 public function rotate_image_gallery_bank( $path, $direction ) {332 if ( function_exists( 'imagerotate' ) ) {333 if ( function_exists( 'wp_get_image_editor' ) ) {334 $obj_img_flip = wp_get_image_editor( $path );335 $obj_img_flip->rotate( $direction );336 $obj_img_flip->save( $path );337 } else {338 list($source_image_width, $source_image_height, $source_image_type) = getimagesize( $path );339 $source_gb_image = false;340 switch ( $source_image_type ) {341 case IMAGETYPE_GIF:342 $source_gb_image = imagecreatefromgif( $path );343 imagealphablending( $source_gb_image, false );344 imagesavealpha( $source_gb_image, true );345 break;346 case IMAGETYPE_JPEG:347 $source_gb_image = imagecreatefromjpeg( $path );348 break;349 case IMAGETYPE_PNG:350 $source_gb_image = imagecreatefrompng( $path );351 imagealphablending( $source_gb_image, false );352 imagesavealpha( $source_gb_image, true );353 break;354 }355 356 $transparency = imagecolorallocatealpha( $source_gb_image, 255, 255, 255, 127 );357 $rotated = imagerotate( $source_gb_image, $direction, $transparency );358 359 if ( is_resource( $rotated ) ) {360 imagealphablending( $rotated, true );361 imagesavealpha( $rotated, true );362 switch ( $source_image_type ) {363 case IMAGETYPE_GIF:364 imagepng( $rotated, $path, 9 );365 break;366 case IMAGETYPE_JPEG:367 imagejpeg( $rotated, $path, 100 );368 break;369 case IMAGETYPE_PNG:370 imagepng( $rotated, $path, 9 );371 break;372 }373 imagedestroy( $source_gb_image );374 return true;375 }376 }377 }378 }379 /**380 241 * This function is used to generate thumbs. 381 242 * … … 415 276 } 416 277 } 417 /**418 * This function is used to restore images.419 *420 * @param string $path_uploads passes parameter as path_uploads.421 * @param string $path_original passes parameter as path_original.422 * @param string $filename passes parameter as file_name.423 * @param string $thumb_dimension passes parameter as thumb_dimension.424 */425 public function restore_image_gallery_bank( $path_uploads, $path_original, $filename, $thumb_dimension ) {426 copy( $path_uploads, $path_original );427 $thumb_dimension = array( $thumb_dimension[2], $thumb_dimension[3] );428 $this->generate_thumbs_edited_image_gallery_bank( $filename, $thumb_dimension );429 }430 /**431 * This function is used to scale images.432 *433 * @param string $image_name passes parameter as image_name.434 * @param string $height passes parameter as height.435 * @param string $width passes parameter as width.436 * @param string $thumb_dimension passes parameter as thumb_dimension.437 */438 public function scale_images_gallery_bank( $image_name, $height, $width, $thumb_dimension ) {439 if ( function_exists( 'wp_get_image_editor' ) ) {440 $image = wp_get_image_editor( GALLERY_BANK_ORIGINAL_DIR . $image_name );441 if ( ! is_wp_error( $image ) ) {442 $image->resize( $width, $height );443 $image->save( GALLERY_BANK_ORIGINAL_DIR . $image_name );444 $this->generate_thumbs_edited_image_gallery_bank( $image_name, $thumb_dimension );445 }446 }447 }448 /**449 * This function is used to image effects.450 *451 * @param string $image_path passes parameter as image_path.452 * @param string $option passes parameter as option.453 * @param string $value passes parameter as value.454 */455 public function image_effects_gallery_bank( $image_path, $option, $value ) {456 $path_info_image = pathinfo( $image_path );457 switch ( $option ) {458 case 'brightness':459 $image_effect = IMG_FILTER_BRIGHTNESS;460 $ratio = $value;461 break;462 463 case 'contrast':464 $image_effect = IMG_FILTER_CONTRAST;465 $ratio = $value;466 break;467 468 case 'grayscale':469 $image_effect = IMG_FILTER_GRAYSCALE;470 $ratio = '';471 break;472 473 case 'negative':474 $image_effect = IMG_FILTER_NEGATE;475 $ratio = '';476 break;477 478 case 'removal':479 $image_effect = IMG_FILTER_MEAN_REMOVAL;480 $ratio = '';481 break;482 483 case 'sepia':484 $image_effect = IMG_FILTER_COLORIZE;485 $red = 90;486 $green = 55;487 $blue = 30;488 break;489 490 case 'dark_slate_grey':491 $image_effect = IMG_FILTER_COLORIZE;492 $red = 47;493 $green = 79;494 $blue = 79;495 break;496 497 case 'saturate':498 $image_effect = IMG_FILTER_COLORIZE;499 $red = 236;500 $green = 40;501 $blue = 41;502 break;503 }504 505 if ( 'grayscale' === $option || 'negative' === $option || 'removal' === $option || 'brightness' === $option || 'contrast' === $option ) {506 switch ( $path_info_image['extension'] ) {507 case 'jpg':508 case 'jpeg':509 $image = imagecreatefromjpeg( $image_path );510 imagefilter( $image, $image_effect, $ratio );511 imagejpeg( $image, $image_path );512 imagedestroy( $image );513 break;514 515 case 'png':516 $image = imagecreatefrompng( $image_path );517 imagealphablending( $image, false );518 imagesavealpha( $image, true );519 imagefilter( $image, $image_effect, $ratio );520 imagepng( $image, $image_path );521 imagedestroy( $image );522 break;523 524 case 'gif':525 $image = imagecreatefromgif( $image_path );526 imagealphablending( $image, false );527 imagesavealpha( $image, true );528 imagefilter( $image, $image_effect, $ratio );529 imagegif( $image, $image_path );530 imagedestroy( $image );531 break;532 }533 } elseif ( 'sepia' === $option || 'dark_slate_grey' === $option || 'saturate' === $option ) {534 switch ( $path_info_image['extension'] ) {535 case 'jpg':536 case 'jpeg':537 $image = imagecreatefromjpeg( $image_path );538 if ( 'sepia' === $option ) {539 imagefilter( $image, IMG_FILTER_GRAYSCALE );540 }541 imagefilter( $image, $image_effect, $red, $green, $blue );542 imagejpeg( $image, $image_path );543 imagedestroy( $image );544 break;545 546 case 'png':547 $image = imagecreatefrompng( $image_path );548 imagealphablending( $image, false );549 imagesavealpha( $image, true );550 if ( 'sepia' === $option ) {551 imagefilter( $image, IMG_FILTER_GRAYSCALE );552 }553 imagefilter( $image, $image_effect, $red, $green, $blue );554 imagepng( $image, $image_path );555 imagedestroy( $image );556 break;557 558 case 'gif':559 $image = imagecreatefromgif( $image_path );560 imagealphablending( $image, false );561 imagesavealpha( $image, true );562 if ( 'sepia' === $option ) {563 imagefilter( $image, IMG_FILTER_GRAYSCALE );564 }565 imagefilter( $image, $image_effect, $red, $green, $blue );566 imagegif( $image, $image_path );567 imagedestroy( $image );568 break;569 }570 }571 }572 /**573 * This function is used to copy images.574 *575 * @param string $image_name passes parameter as image_name.576 * @param string $x_axis passes parameter as x_axis.577 * @param string $y_axis passes parameter as y_axis.578 * @param string $crop_height passes parameter as crop_height.579 * @param string $crop_width passes parameter as crop_width.580 * @param string $thumb_dimension passes parameter as thumb_dimension.581 */582 public function crop_images_gallery_bank( $image_name, $x_axis, $y_axis, $crop_height, $crop_width, $thumb_dimension ) {583 if ( function_exists( 'wp_get_image_editor' ) ) {584 $obj_image = wp_get_image_editor( GALLERY_BANK_ORIGINAL_DIR . $image_name );585 $size = $obj_image->get_size();586 $width = $size['width'];587 $height = $size['height'];588 $scale = 1 / $this->image_get_preview_ratio_gallery_bank( $width, $height );589 $obj_image->crop( $x_axis * $scale, $y_axis * $scale, $crop_width * $scale, $crop_height * $scale );590 $copy_image = pathinfo( GALLERY_BANK_ORIGINAL_DIR . $image_name );591 $image_copy = $copy_image['dirname'] . '/' . $copy_image['filename'] . '.' . $copy_image['extension'];592 $filename = $copy_image['filename'] . '.' . $copy_image['extension'];593 $obj_image->save( $image_copy );594 $this->generate_thumbs_edited_image_gallery_bank( $filename, $thumb_dimension );595 }596 }597 /**598 * This function is used to get preview ratio.599 *600 * @param string $w passes parameter as w.601 * @param string $h passes parameter as h.602 */603 public function image_get_preview_ratio_gallery_bank( $w, $h ) {604 $max = max( $w, $h );605 return $max > 500 ? ( 500 / $max ) : 1;606 }607 /**608 * This function is used to set watermark on images.609 *610 * @param string $watermark_settings passes parameter as watermark_settings.611 * @param string $image_path passes parameter as image_path.612 */613 public function set_watermark_image_gallery_bank( $watermark_settings, $image_path ) {614 $watermark_image_path = WP_CONTENT_DIR . esc_attr( $watermark_settings['watermark_settings_url'] );615 $path_info_watermark = pathinfo( $watermark_image_path );616 $path_info_image = pathinfo( $image_path );617 switch ( $path_info_watermark['extension'] ) {618 case 'jpg':619 case 'jpeg':620 $image_watermark = imagecreatefromjpeg( $watermark_image_path );621 break;622 623 case 'png':624 $image_watermark = imagecreatefrompng( $watermark_image_path );625 if ( $this->is_alpha_png_gallery_bank( $watermark_image_path ) ) {626 imagealphablending( $image_watermark, false );627 imagesavealpha( $image_watermark, true );628 }629 break;630 631 case 'gif':632 $image_watermark = imagecreatefromgif( $watermark_image_path );633 break;634 }635 switch ( $path_info_image['extension'] ) {636 case 'jpg':637 case 'jpeg':638 $image = imagecreatefromjpeg( $image_path );639 break;640 641 case 'png':642 $image = imagecreatefrompng( $image_path );643 break;644 645 case 'gif':646 $image = imagecreatefromgif( $image_path );647 break;648 }649 $offset_split = explode( ',', isset( $watermark_settings['watermark_setting_offset'] ) ? esc_attr( $watermark_settings['watermark_setting_offset'] ) : '0,0' );650 list($image_width, $image_height) = $this->get_image_size_gallery_bank( $image );651 list($watermark_width, $watermark_height) = $this->get_image_size_gallery_bank( $image_watermark );652 if ( intval( $watermark_settings['watermark_settings_size'] ) < 100 ) {653 $watermark_width_new = ( floatval( $watermark_settings['watermark_settings_size'] ) / 100 ) * $watermark_width;654 $watermark_height_new = ( floatval( $watermark_settings['watermark_settings_size'] / 100 ) ) * $watermark_height;655 $temp_image = imagecreatetruecolor( $watermark_width_new, $watermark_height_new );656 if ( $this->is_alpha_png_gallery_bank( $watermark_image_path ) && 'png' === $path_info_watermark['extension'] ) {657 imagealphablending( $temp_image, false );658 imagesavealpha( $temp_image, true );659 }660 imagecopyresampled( $temp_image, $image_watermark, 0, 0, 0, 0, $watermark_width_new, $watermark_height_new, $watermark_width, $watermark_height );661 662 imagedestroy( $image_watermark );663 $image_watermark = $temp_image;664 $watermark_width = $watermark_width_new;665 $watermark_height = $watermark_height_new;666 unset( $temp_image, $watermark_width_new, $watermark_height_new );667 }668 $watermark_position = $this->get_watermark_position_gallery_bank( esc_attr( $watermark_settings['watermark_settings_position'] ) );669 $offset_x = $this->compute_offset_gallery_bank( $watermark_position[0], $offset_split[0], $image_width, $watermark_width, false );670 $offset_y = $this->compute_offset_gallery_bank( $watermark_position[1], $offset_split[1], $image_height, $watermark_height, false );671 $param = array( $image, $image_watermark, $offset_x, $offset_y, 0, 0, $watermark_width, $watermark_height );672 if ( 'png' === $path_info_watermark['extension'] && $this->is_alpha_png_gallery_bank( $watermark_image_path ) ) {673 $function = 'imagecopy';674 } else {675 $function = 'imagecopymerge';676 $param[] = intval( $watermark_settings['watermark_setting_opacity'] );677 }678 call_user_func_array( $function, $param );679 switch ( $path_info_image['extension'] ) {680 case 'jpeg':681 case 'jpg':682 imagejpeg( $image, $image_path );683 break;684 685 case 'png':686 imagealphablending( $image, false );687 imagesavealpha( $image, true );688 imagepng( $image, $image_path );689 break;690 691 case 'gif':692 imagegif( $image, $image_path );693 break;694 }695 }696 /**697 * This function is used set watermark text.698 *699 * @param string $watermark_settings passes parameter as watermark settings.700 * @param string $image_path passes parameter as image path.701 */702 public function set_watermark_text_gallery_bank( $watermark_settings, $image_path ) {703 $watermark_text = isset( $watermark_settings['watermark_settings_text'] ) ? esc_attr( $watermark_settings['watermark_settings_text'] ) : '';704 $watermark_font = GALLERY_BANK_PLUGIN_DIR_PATH . '/fonts/arial.ttf';705 $watermark_font_style = explode( ',', isset( $watermark_settings['watermark_settings_font_style'] ) ? esc_attr( $watermark_settings['watermark_settings_font_style'] ) : '20,#cccccc' );706 $watermark_font_color = $this->hexrgb_convertor_gallery_bank( $watermark_font_style[1] );707 $angle = isset( $watermark_settings['watermark_setting_angle'] ) ? esc_attr( $watermark_settings['watermark_setting_angle'] ) : '0';708 $file_info = pathinfo( $image_path );709 switch ( $file_info['extension'] ) {710 case 'jpeg':711 case 'jpg':712 $image = imagecreatefromjpeg( $image_path );713 break;714 715 case 'png':716 $image = imagecreatefrompng( $image_path );717 break;718 719 case 'gif':720 $image = imagecreatefromgif( $image_path );721 break;722 }723 $offset_split = explode( ',', isset( $watermark_settings['watermark_setting_offset'] ) ? esc_attr( $watermark_settings['watermark_setting_offset'] ) : '0,0' );724 list($image_width, $image_height) = $this->get_image_size_gallery_bank( $image );725 $color = imagecolorallocatealpha( $image, $watermark_font_color['red'], $watermark_font_color['green'], $watermark_font_color['blue'], 127 * ( 100 - intval( $watermark_settings['watermark_setting_opacity'] ) ) / 100 );726 list($text_width, $text_height, $delta_x, $delta_y) = $this->get_text_size_gallery_bank( $watermark_font_style[0], $angle, $watermark_font, $watermark_text );727 $watermark_position = $this->get_watermark_position_gallery_bank( esc_attr( $watermark_settings['watermark_settings_position'] ) );728 729 $x_cordinates = $this->compute_offset_gallery_bank( $watermark_position[0], $offset_split[0], $image_width, $text_width, false );730 $y_cordinates = $this->compute_offset_gallery_bank( $watermark_position[1], $offset_split[1], $image_height, $text_height, false );731 imagettftext( $image, $watermark_font_style[0], $angle, $x_cordinates - $delta_x, $y_cordinates - $delta_y, $color, $watermark_font, $watermark_text );732 switch ( $file_info['extension'] ) {733 case 'jpeg':734 case 'jpg':735 imagejpeg( $image, $image_path );736 break;737 738 case 'png':739 imagealphablending( $image, false );740 imagesavealpha( $image, true );741 imagepng( $image, $image_path );742 break;743 744 case 'gif':745 imagegif( $image, $image_path );746 break;747 }748 }749 /**750 * This function is used to get watermark position.751 *752 * @param string $position passes parameter as position.753 */754 public function get_watermark_position_gallery_bank( $position ) {755 switch ( $position ) {756 case 'top_left':757 $x = 1;758 $y = 1;759 break;760 761 case 'top_center':762 $x = 2;763 $y = 1;764 break;765 766 case 'top_right':767 $x = 3;768 $y = 1;769 break;770 771 case 'middle_left':772 $x = 1;773 $y = 2;774 break;775 776 case 'middle_center':777 $x = 2;778 $y = 2;779 break;780 781 case 'middle_right':782 $x = 3;783 $y = 2;784 break;785 786 case 'bottom_left':787 $x = 1;788 $y = 3;789 break;790 791 case 'bottom_center':792 $x = 2;793 $y = 3;794 break;795 796 case 'bottom_right':797 $x = 3;798 $y = 3;799 break;800 }801 return array( $x, $y );802 }803 /**804 * This function is is_alpha_png.805 *806 * @param string $file passes parameter as file.807 */808 public function is_alpha_png_gallery_bank( $file ) {809 /*810 * Color type of png image stored at 25 byte:811 * 0 - greyscale812 * 2 - RGB813 * 3 - RGB with palette814 * 4 - greyscale + alpha815 * 6 - RGB + alpha816 */817 $color_byte = ord( file_get_contents( $file, false, null, 25, 1 ) ); // @codingStandardsIgnoreLine818 return ( 6 == $color_byte || 4 == $color_byte ); // WPCS: loose comparison ok.819 }820 /**821 * This function is used for Update data in database.822 *823 * @param string $position passes parameter as position.824 * @param string $offset passes parameter as offset.825 * @param string $img_dim passes parameter as imgDim.826 * @param string $w_dim passes parameter as wDim.827 * @param string $status passes parameter as status.828 */829 public function compute_offset_gallery_bank( $position, $offset, $img_dim, $w_dim, $status ) {830 if ( $status ) {831 $offset = round( ( $offset / 100 ) * $img_dim );832 }833 switch ( $position ) {834 case 1:835 break;836 case 2:837 $offset = ( ( $img_dim - $w_dim ) / 2 ) + $offset;838 break;839 case 3:840 $offset = $img_dim - $w_dim - $offset;841 break;842 }843 return (int) $offset;844 }845 /**846 * This function is used get image size.847 *848 * @param string $image_path passes parameter as image path.849 */850 public function get_image_size_gallery_bank( $image_path ) {851 $image_dimension = array( imagesx( $image_path ), imagesy( $image_path ) );852 return( $image_dimension );853 }854 /**855 * This function is used get image size.856 *857 * @param string $font_size passes parameter as fontSize.858 * @param string $angle passes parameter as angle.859 * @param string $font passes parameter as font.860 * @param string $text passes parameter as text.861 */862 public function get_text_size_gallery_bank( $font_size, $angle, $font, $text ) {863 $bb = imagettfbbox( $font_size, $angle, $font, $text );864 865 $max_x = max( $bb[0], $bb[2], $bb[4], $bb[6] );866 $min_x = min( $bb[0], $bb[2], $bb[4], $bb[6] );867 $x = $max_x - $min_x;868 869 $max_y = max( $bb[1], $bb[3], $bb[5], $bb[7] );870 $min_y = min( $bb[1], $bb[3], $bb[5], $bb[7] );871 $y = $max_y - $min_y;872 873 return array( $x, $y, $min_x, $min_y );874 }875 /**876 * This function is hexrgb_convertor_gallery_bank.877 *878 * @param string $hexstr passes parameter as fontSize.879 */880 public function hexrgb_convertor_gallery_bank( $hexstr ) {881 $int = hexdec( $hexstr );882 return array(883 'red' => 0xFF & ( $int >> 0x10 ),884 'green' => 0xFF & ( $int >> 0x8 ),885 'blue' => 0xFF & $int,886 );887 }888 278 } 889 279 } -
gallery-bank/trunk/user-views/includes/galleries/structure.php
r1832706 r2199314 46 46 case 'foo_box_free_edition': 47 47 if ( ! class_exists( 'fooboxV2' ) ) { 48 wp_enqueue_style( 'foobox. free.min.css', GALLERY_BANK_PLUGIN_DIR_URL . 'user-views/assets/lightboxes/foobox/css/foobox.free.min.css' );49 wp_enqueue_style( 'foobox.noie7.min.css', GALLERY_BANK_PLUGIN_DIR_URL . 'user-views/assets/lightboxes/foobox/css/foobox.noie7.min.css' );50 wp_enqueue_script( 'foobox. free.min.js', GALLERY_BANK_PLUGIN_DIR_URL . 'user-views/assets/lightboxes/foobox/js/foobox.free.min.js' );48 wp_enqueue_style( 'foobox..min.css' ); 49 wp_enqueue_style( 'foobox.noie7.min.css', GALLERY_BANK_PLUGIN_DIR_URL . 'user-views/assets/lightboxes/foobox/css/foobox.noie7.min.css' ); 50 wp_enqueue_script( 'foobox..min.js' ); 51 51 } 52 52 break; -
gallery-bank/trunk/user-views/layouts/masonry-layout/masonry-layout.php
r1832706 r2199314 37 37 $no_lightbox_imageurl = isset( $pic['enable_redirect'] ) && '1' !== $pic['enable_redirect'] ? '' : ( isset( $pic['redirect_url'] ) ? esc_attr( $pic['redirect_url'] ) : '' ); 38 38 $enable_redirect = $pic['enable_redirect']; 39 $foobox_imageurl = isset( $pic['enable_redirect'] ) && '0' !== $pic['enable_redirect'] && '' !== $pic['enable_redirect'] ? esc_ attr( $pic['redirect_url'] ) : ( 'image' === $pic['file_type'] ? $filename_original_path : '');39 $foobox_imageurl = isset( $pic['enable_redirect'] ) && '0' !== $pic['enable_redirect'] && '' !== $pic['enable_redirect'] ? esc_ ); 40 40 $target = isset( $pic['enable_redirect'] ) && '0' !== $pic['enable_redirect'] && '' !== $pic['enable_redirect'] ? '_blank' : ''; 41 41 if ( isset( $lightbox_type ) ) { -
gallery-bank/trunk/user-views/layouts/thumbnail-layout/thumbnail-layout.php
r1860174 r2199314 33 33 $no_lightbox_imageurl = isset( $pic['enable_redirect'] ) && '1' !== $pic['enable_redirect'] ? '' : ( isset( $pic['redirect_url'] ) ? esc_attr( $pic['redirect_url'] ) : '' ); 34 34 $enable_redirect = isset( $pic['enable_redirect'] ) ? $pic['enable_redirect'] : ''; 35 $foobox_imageurl = isset( $pic['enable_redirect'] ) && '0' !== $pic['enable_redirect'] && '' !== $pic['enable_redirect'] ? esc_attr( $pic['redirect_url'] ) : ( 'image' === $pic['file_type'] ? $filename_original_path : '' ); 36 37 $target = isset( $pic['enable_redirect'] ) && '0' !== $pic['enable_redirect'] && '' !== $pic['enable_redirect'] ? '_blank' : ''; 35 $foobox_imageurl = isset( $pic['enable_redirect'] ) && '0' !== $pic['enable_redirect'] && '' !== $pic['enable_redirect'] ? esc_url( $pic['redirect_url'] ) : ( 'image' === $pic['file_type'] ? $filename_original_path : esc_url( $pic['video_url'] ) ); 36 $target = isset( $pic['enable_redirect'] ) && '0' !== $pic['enable_redirect'] && '' !== $pic['enable_redirect'] ? '_blank' : ''; 38 37 ?> 39 38 <div id="grid_wrapper_item_<?php echo intval( $random ) . '_' . intval( $pic['id'] ); ?>" class="grid_wrapper_item gb_animate" data-animate="<?php echo isset( $animation_effects ) ? esc_attr( $animation_effects ) : 'none'; ?>" data-duration="1.0s" data-delay="0.1s" data-offset="100"> -
gallery-bank/trunk/views/galleries/add-gallery.php
r2195382 r2199314 89 89 </label> 90 90 <?php 91 $gallery_description = isset( $get_gallery_meta_data_unserialize['gallery_description'] ) ? $get_gallery_meta_data_unserialize['gallery_description']: '';91 $gallery_description = isset( $get_gallery_meta_data_unserialize['gallery_description'] ) ? : ''; 92 92 wp_editor( $gallery_description, 'ux_heading_content', array( 93 93 'teeny' => true,
Note: See TracChangeset
for help on using the changeset viewer.