WordPress/GD resize images first, then crop height to a multiple of 18px minus 8px

故事扮演 提交于 2019-12-24 11:16:55

问题


here's (a strange) one for you.

I'm working on WordPress site where it's important to have images sit on a baseline grid of 18px, where total image dimensions are always multiples of 18px, with the height cropped by an extra 8px. This is mostly a layout thing and to have images play nicely with text.

I am trying to figure out how to hook into WP/GD functionality where:

  1. Image is resized as normal (thumbnail, medium, large), setting max width only in WP admin.
  2. The image height is (math, round?) cropped to the closest multiple value of X (in this case 18px).
  3. Using the new height, crop again by subtracting another X value of the height (in this case 8px).

The end result would ideally be a plugin where values can be activated and edited for individual users in a multi-site environment.

Have searched and searched, but none the wiser.

Any ideas or (paid) help would be fabulous, many thanks!

F.


回答1:


i'm seeking the same behavior for a website. I found several plugins http://wordpress.org/extend/plugins/resize-at-upload/ or http://wordpress.org/extend/plugins/resize-on-upload/ which show that we can add an action to "wp_handle_upload".

I dig this way !



来源:https://stackoverflow.com/questions/4874484/wordpress-gd-resize-images-first-then-crop-height-to-a-multiple-of-18px-minus-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!