Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter eastbank

    (@eastbank)

    I see that I can easily do what I’m asking if I just use a single field group, then give the image field within that group the ability to be duplicated. However, the re-ordering functionality is really needed and that’s not an option when doing it that way.

    I’m using this method of outputting the duplicated field groups:

    <?php
           $members = get_order_group('members_name');
           foreach($members as $member){
           echo get_image('members_photo',$member);
           }
        ?>

    Which works great for outputting the thumbnail image…but I cannot figure out how to get it to output a URL to a custom sized image.

    Thread Starter eastbank

    (@eastbank)

    So here’s an update:
    I decided to try the code I have used to grab data from multiple field sets from the Custom Field Template plugin. This was successful, however, it only outputs the first and last groups….any ideas??

    <?php // retrieve entries with photo_gallery_image prefix
    				$sql = " SELECT * FROM $wpdb->postmeta	WHERE post_id = $post->ID AND meta_key LIKE '%photo_gallery_image%' ORDER BY meta_id ASC";
    				$data_objects = $wpdb->get_results($sql);
    				$project = array();
    				$i = 0;
    
    				foreach($data_objects as $data) {
    
    					// the name of the fieldset:
    					if($data->meta_key == 'photo_gallery_image') {
    						$limit = $data->meta_value;
    					}
    
    					$i = ( $i <= $limit ) ? $i : 1;
    
    					if( $data->meta_value != $limit ) {
    					$project[$i]["$data->meta_key"] = $data->meta_value;
    					}
    					$i++;
    				}
    				//check data
    				//print_r($project);
    
    				foreach( $project as $key){
    					?>
    
    <?php
    $attachment_id = $key['photo_gallery_image_gallery_image']; // attachment ID
    
    $image_attributes = wp_get_attachment_image_src( $attachment_id,'large','' ); // returns an array
    ?> 
    
    <li>
    <a class="group1" href="<?php echo $image_attributes[0]; ?>"><img src="<?php echo wp_get_attachment_thumb_url($key['photo_gallery_image_gallery_image']); ?>"/></a>
    </li>    
    
                        <?php
    					// etc....
    				} ?>
    Plugin Author hunk

    (@hunk)

    Hi, in get_image check param $tag_img,

    https://wiki.magicfields.org/doku.php?id=front-end_functions_v20#get_image

    echo get_image(‘photo_gallery_image’,$my_group,$field_index,0); //this return the path of thumbnail

    Thread Starter eastbank

    (@eastbank)

    You are my hero.

    Thank you so much for the quick reply!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Magic Fields 2] output URL to image file (not original size)’ is closed to new replies.