Thumbnail size keeps resetting automatically
Thumbnail size keeps resetting automatically
Thumbnail size keeps resetting automatically
The display/use of various <img> attributes is up to the theme code. If the theme code does not use the info from the media item, then it will not display. Fixing this will require digging into the theme code to figure out where the <img> code is generated, and then modifying that code. Note that … Read more
I’ve just found the reason why: the image is smaller than the thumbnail dimensions. That’s the reason why.
Not sure how you’re using it, but wp_get_attachment_image_src() returns an array. This should work: <?php $attachmentID = 519271; $imageSizeName = “thumbnail”; $img = wp_get_attachment_image_src($attachmentID, $imageSizeName); ?> <img src=”<?php echo $img[0]; ?>” alt=”image”> An alternative to try if it isn’t working: <img src=”<?php echo wp_get_attachment_url(519271); ?>” alt=”image”> This thread discusses your issue further: wp_get_attachment_image_src always returns … Read more
If you have access to the old WordPress site go into the admin section then > Tools > Export. Where it says Choose what to export check All content, and click Download Export file. In the new WordPress site go into the admin section > Tools > Import > choose WordPress form the list (it … Read more
If you want to show the File type of featured image. then try the below code. <?php $id1 = get_post_thumbnail_id($post->ID); $type = get_post_mime_type( $id1 ); $mime_type = explode(“https://wordpress.stackexchange.com/”, $type); $type=”.”.$mime_type[‘1’]; echo $type; ?> It will display the exact extension that you want “.jpeg” from “image/jpeg” Here “$post->ID” is current post id (or the id of … Read more
It’s already in the docs. Try this: <?php $image = get_field(‘image’); if( !empty($image) ): ?> <img src=”https://wordpress.stackexchange.com/questions/223867/<?php echo $image[“url’]; ?>” alt=”https://wordpress.stackexchange.com/questions/223867/<?php echo $image[“alt’]; ?>” /> <?php endif; ?> For easier debugging, try this: var_dump($image); to print out the $image variable to know what is in $image. You can also put var_dump($image) inside <pre> tag for … Read more
Following function calculate file size, just you need change ‘/myfile/image.jpg’ with your featured image variable. <?php function file_size($url){ $size = filesize($url); if($size >= 1073741824){ $fileSize = round($size/1024/1024/1024,1) . ‘GB’; }elseif($size >= 1048576){ $fileSize = round($size/1024/1024,1) . ‘MB’; }elseif($size >= 1024){ $fileSize = round($size/1024,1) . ‘KB’; }else{ $fileSize = $size . ‘ bytes’; } return $fileSize; … Read more
Have you tried this plugin from Addthis: https://wordpress.org/plugins/addthis/
You could try this plugin to reduce file size before the upload.