Get a different size of Image thumbnail while working with custom metabox

I am using custom metabox for a page in my new project, I am using it for uploading image, and attaching it to the page. It's working fine, I can select image or upload the image using WordPress' native uploader, and attach it. The issue is that I am getting the large size image only.

What happens is I have to resize it by specifying its width and height. Is there any way to get the other sizes of the uploaded or selected images via WordPress native uploader.

I know I can get the thumbnails by using wp_get_attachment_image_src function, but in order to work with this function I have to get attachment_id, I don't have it.

What I have is only image url. I don't know whether I am missing it somewhere or not.

Topic thumbnails metabox images customization Wordpress

Category Web


use this one and follow the structures

  $post_thumbnail_id = get_post_thumbnail_id( $post_id ); 
 $imgarr = wp_get_attachment_image_src($post_thumbnail_id,'medium'); 
 echo $imgarr[0];/*it will return image url in medium size*/

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.