pressupinc / require-featured-image

A WordPress plugin to require that a Featured Image is added to a post before it gets published
21 stars 16 forks source link

Scaling an image in Wordpress can cause a page to show with an image that is smaller than the required minimum size #15

Open torohill opened 7 years ago

torohill commented 7 years ago

Reproduction steps:

  1. Set the RFI minimum width and height settings.
  2. Go to the edit page screen, add a featured image that is larger than the minimum RFI size, and publish the page.
  3. Go to Media in the Wordpress admin.
  4. Edit the image that was selected in step 2 and scale it down to smaller than the minimum RFI size.
  5. It is now possible to view the page with an image that is too small.

Note that this is only a problem when the full size image is used in the page (eg. the_post_thumbnail('full')). If a particular thumbnail size is used then the thumbnail that was generated from the original large image will be displayed, and this should be sized correctly.

I'm not sure if there is any sane way to prevent this from happening, probably not. Perhaps the best that can be done is add a note to the readme that says if you are using a minimum size in RFI then don't scale down images that are used as features, or don't use full size images in your theme code.

davidbhayes commented 7 years ago

Is this the same issue as fixed by #13, or is it slightly different?

If this is really beyond the post editing screen, I'm tempted to treat it as out-of-scope for the plugin. Seems like you'd have to pretty actively be looking to countermand the plugin to discover this "loophole" and I'm not sure it worth the maintenance overhead to protect from cases that narrow.

torohill commented 7 years ago

It's a slightly different issue to #13 as it involves scaling an image after it has been assigned as feature instead of before. I think you are right in that the plugin shouldn't try and prevent this behaviour. Perhaps the best that can be done is a warning in the readme, or maybe even a warning that is displayed on the edit media page if there is a minimum RFI size currently set.

Either way I don't think it's a particularly significant issue, just thought I would mention it.