Make WordPress Core

Opened 9 years ago

Last modified 6 years ago

#35775 new enhancement

Enhancements: add_post_thumbnail_image_size / wp_get_attachment_id

Reported by: torbentschechnegmailcom's profile torben.tschechne@… Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Media Keywords:
Focuses: Cc:

Description

Hello,
I hope I am in the right place here to suggest two enhancements for WP core.

1:
From my perspective the most used image of a post is the post-thumbnail. I use this post thumbnail quite often in different sizes - for teasers, related posts, sliders etc. From a performance perspective I always want to deliver the image in the correct dimensions. No 1600px image in a related post section where the image is 200px wide etc. I am struggling a bit because I often work on websites which have a lot of pictures in their posts. When I add a new image size its always relevant for all images which are uploaded to WP and often they are not necessary. I do not need a 200px wide image of 20 images which are used in the post - I only need it for the post-thumbnail. From that perspective I would like to have another function than add_image_size - for example: add_post_thumbnail_image_size which is only triggered when somebody selected an image as the post-thumbnail. This will save space on the servers as well.

2:
Sometimes I have the case that I need the attachment ID of an url that has been uploaded. For example: I delevoped a plugin where an image can be chosen, the input field is a text field for a URL. In that case I need to determine the attachment ID to have access to all the necessary WP functions. In this case I built my own function that does it, but I think it will also be a function that can be helpful if it is integrated in WP.

Looking forward to your reply.

In order to always get the image in the correct dimensions which are

Change History (1)

#1 @swissspidy
9 years ago

  • Focuses accessibility performance removed
  • Version 4.4.1 deleted

I do not need a 200px wide image of 20 images which are used in the post - I only need it for the post-thumbnail. From that perspective I would like to have another function than add_image_size - for example: add_post_thumbnail_image_size which is only triggered when somebody selected an image as the post-thumbnail. This will save space on the servers as well.

See #13372 (kind of) and http://wordpress.stackexchange.com/questions/108572/set-post-thumbnail-size-vs-add-image-size/ for a workaround.

Sometimes I have the case that I need the attachment ID of an url that has been uploaded. For example: I delevoped a plugin where an image can be chosen, the input field is a text field for a URL. In that case I need to determine the attachment ID to have access to all the necessary WP functions.

See attachment_url_to_postid() and #16830

Note: See TracTickets for help on using tickets.