WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Attachments Plugins - get medium size of image (4 posts)

  1. toto
    Member
    Posted 4 years ago #

    Hello friends Im use a WordPress Attachments Plugin 1.0.7.2. Here is the link - http://mondaybynoon.com/wordpress-attachments/

    I need to get or retrieve the medium size of the attached image.

    The plugin use and works width

    'mime' 			=> stripslashes( get_post_mime_type( $data['id'] ) ),
    				'title' 		=> stripslashes( $data['title'] ),
    				'caption' 		=> stripslashes( $data['caption'] ),
    				'location' 		=> stripslashes( wp_get_attachment_url( $data['id'] ) ),
    				'link'			=> stripslashes( wp_get_attachment_link( $data['id'] ) ),

    But cannot get the medium size or image_get_intermediate_size of the picure. I can retrieve only small and big size. Please for eny help or suggestions or hack. Many many thanks....

  2. Jonathan Christopher
    Member
    Posted 4 years ago #

    You'll want to use wp_get_attachment_image_src with the attachment id you're working with

    e.g.

    $my_image = wp_get_attachment_image_src( $attachments[$i]['id'], 'medium' );
    $my_image = $my_image[0];

    $my_image will contain the URL to your medium sized image.

    Hope that helps!

  3. toto
    Member
    Posted 4 years ago #

    not work :(

    is there another type to get - wp_get_attachment_image_src

    $attachment_details = array(
    						'id' 				=> $_POST['attachment_id_' . $i],
    						'title' 			=> $_POST['attachment_title_' . $i],
    						'caption' 			=> $_POST['attachment_caption_' . $i],
    						'order' 			=> $_POST['attachment_order_' . $i]
    					);
  4. toto
    Member
    Posted 4 years ago #

    Hello all this code works propertly but it show thelink and word Array
    how to fix it

    Example: Array http://www.servert.com/....img.jpg

    <?=$my_image = $my_image = wp_get_attachment_image_src( $attachments[$i]['id'], 'medium' ); ?>

    <?=$my_image = $my_image[0];?>

    How to use it not to shoo Array word before the link?

Topic Closed

This topic has been closed to new replies.

About this Topic