Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // image field
- array(
- 'type' => 'text',
- 'label' => __( 'Image Size', 'wphash' ),
- 'name' => 'img_size',
- 'value' => 'thumbnail ',
- 'description' => __(' Set the image size: "full", "thumbnail", "medium", "large" or other size. ex: 250x200', 'wphash'),
- ),
- // image data output
- $data_image = '';
- $size_array = array('full', 'medium', 'large', 'thumbnail');
- if ($image) {
- $image_full_width_data = wp_get_attachment_image_src( $image, 'full' );
- $image_full = $image_full_width_data[0];
- $image_alt = get_post_meta( $image, '_wp_attachment_image_alt', true);
- if( in_array( $img_size, $size_array ) ){
- $image_data = wp_get_attachment_image_src( $image, $img_size );
- $image_url = $image_data[0];
- }else{
- $image_url = kc_tools::createImageSize( $image_full, $img_size );
- }
- $data_image .= '<div class="activity-icon">';
- $data_image .= '<img src="'.$image_url.'" alt="'.$image_alt.'" >';
- $data_image .= '</div>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement