php - Wordpress is not getting the correct image thumbnail size -


so have code in functions file create custom image size:

add_image_size( 'tiny_thumb', 10, 10, false ); 

now in template file need tiny thumb can generate base64 image url:

$image = get_the_post_thumbnail_url($postid, 'tiny_thumb'); $ext = pathinfo($image, pathinfo_extension); $base64 = 'data:image/' . $ext . ';base64,' . base64_encode(file_get_contents($image)); 

now problem images it's getting tiny thumb, 10x10 image. others full size image used. have checked , images full size image used there 10x10 version of image. exists.

anyone know why might doing this.

the reason need use tiny thumb generate base64 image if uses full size image generated base64 html large size.

hope make sense

cheers

ok figured out whats going on. images using 10x10 image size had been uploaded after new image size created(so when new post created). images associated tiny_thumb.

i had used regenerate thumbnails plugin on localhost, uploaded new image sizes live site. doing way 10x10 images not associated tiny thumb.

the solution. had run regenerate thumbnails plugin on our live site associate 10x10 image sizes tiny_thumb

thanks fluffykitten helping out :)


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -