WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Need help for echo (php) (1 post)

  1. xinfo
    Member
    Posted 4 years ago #

    Hey guys i wantto echo the size of height and width i am not sure how to print like alt plzhelpi have placed my function for image below

    # Displays post image attachment (sizes: thumbnail, medium, full)
    function dp_attachment_image($postid=0, $size='thumbnail', $attributes='') {
    	if ($postid<1) $postid = get_the_ID();
    	if ($images = get_children(array(
    		'post_parent' => $postid,
    		'post_type' => 'attachment',
    		'numberposts' => 1,
    		'post_mime_type' => 'image',)))
    		foreach($images as $image) {
    			$attachment=wp_get_attachment_image_src($image->ID, $size);
    			?><img src="<?php echo $attachment[0]; ?>" <?php echo $attributes; ?> /><?php
    		}
    }

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags