• Resolved theme2021

    (@theme2021)


    I cant get to image with my own size that I have registered.
    I am using an example from here:

    $cmb->add_field( array(
    	'name'    => 'Test File',
    	'desc'    => 'Upload an image or enter an URL.',
    	'id'      => 'wiki_test_image',
    	'type'    => 'file',
    	// Optional:
    	'options' => array(
    		'url' => false, // Hide the text input for the url
    	),
    	'text'    => array(
    		'add_upload_file_text' => 'Add File' // Change upload button text. Default: "Add or Upload File"
    	),
    	// query_args are passed to wp.media's library query.
    	'query_args' => array(
    		'type' => 'application/pdf', // Make library only display PDFs.
    		// Or only allow gif, jpg, or png images
    		// 'type' => array(
    		// 	'image/gif',
    		// 	'image/jpeg',
    		// 	'image/png',
    		// ),
    	),
    	'preview_size' => 'large', // Image size to use when previewing in the admin.
    ) );

    link: https://github.com/CMB2/CMB2/wiki/Field-Types#file

    $image = wp_get_attachment_image( get_post_meta( get_the_ID(), 'wiki_test_image_id', 1 ), 'my-size' );

    but when i try to output the image (echo $image) i don’t get nothing.
    var_dump($image); deduces: string(0) “”

    Need help.

    • This topic was modified 3 years, 11 months ago by theme2021.
    • This topic was modified 3 years, 11 months ago by theme2021.
    • This topic was modified 3 years, 11 months ago by theme2021.
    • This topic was modified 3 years, 11 months ago by theme2021.
    • This topic was modified 3 years, 11 months ago by theme2021.
    • This topic was modified 3 years, 11 months ago by theme2021.
    • This topic was modified 3 years, 11 months ago by theme2021.
    • This topic was modified 3 years, 11 months ago by theme2021.
    • This topic was modified 3 years, 11 months ago by theme2021.
    • This topic was modified 3 years, 11 months ago by theme2021.
    • This topic was modified 3 years, 11 months ago by theme2021.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Output image with my size’ is closed to new replies.