Q: How to get custom field image url of specific size I have a "cmb2" custom field with type->file. and i use it to upload images.
If i use:
echo get_post_meta( $post->ID, '_pf_photo1', 'medium' );
i get the url of the full image (not the medium one).
How can i get the url of the 'medium' / 'thumbnail' and so on...

A: You can get the ID of the file with _pf_photo1_id, then it's easy to get any size URL:
$file_id = get_post_meta( $post->ID, '_pf_photo1_id', true );

if ( $file_id )
    echo wp_get_attachment_image_url( $file_id, 'medium' );


A: The get_post_meta() function can help to get the meta field but will not retrieve different size.
Assuming _pf_photo1 embed the attachment id, you can do something like that:
// Note the "_id" suffix
$attachment_id = get_post_meta($post->ID, '_pf_photo1_id', true);

Last parameter for this function can not be 'medium', 
Now,you can use $attachment_id with different function depending on what you really want to get (url, img element...):
$attachment_element = wp_get_attachment_image( $attachment_id, 'medium' );
echo $attachment_element;

There is more ways to get details for attachment wp_get_attachment_url(), wp_get_attachment_image_src (that returns an array with url, width, height).
You will find more details to discover these functions here
Hope it helps !
