Tag Info

New answers tagged

2

Sure - php can definitely handle simple math like this. All you'd have to do is reference the numbers coming back from the wp_get_attachment_image_src call: <?php if ( has_post_thumbnail()) { $full_image_info = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full'); $img_h = $full_image_info[1]; $img_w = $full_image_info[2]; ...


1

The UI might be slightly different depending on what version of WordPess you are running but just before you select the insert button/link, simply just select 'Full Size' size image from the dropdown menu.


0

Try to upload image from featured image option and to fetch it use the below code where you can set height and width parameters according to your need: <a href="<?php echo get_permalink($post->ID);?>"><?php if ( has_post_thumbnail()) { $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large'); echo '<img ...


1

The URL for rezied images in WordPress is constructed in a way that's impossible to direct reverse. Therefore, it's impossible to get the attachment associated with a URL of a resized image with 100% certainty, unless you loop through all attachments and check whether their URL matches the given URL. However, this approach is very slow and ...


0

The problem was that I read the image sizes inside the "init" hook at which point the additional sizes are not loaded yet by Wordpress. I used a "later" hook now and it works.



Top 50 recent answers are included