问题
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:
- Image is resized as normal (thumbnail, medium, large), setting max width only in WP admin.
- The image height is (math, round?) cropped to the closest multiple value of X (in this case 18px).
- 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