1

Looking at the documentation for Cropping Thumbnails when adding new image-sizes makes me confused.

Set the image size by cropping the image and defining a crop position:

add_image_size( 'custom-size', 220, 220, array( top, left ) ); // Hard crop top left

When setting a crop position, the first value in the array is the x axis crop position, the second is the y axis crop position.

x_crop_position accepts 'left' 'center', or 'right'. y_crop_position accepts 'top', 'center', or 'bottom'.

By this array(top, left) wouldn't be "allowed" because top is only allowed by y-crop position ?

  • Please add quotes from pages in blockquote, and don't use bold wording unnecessary, it is taken as shouting if used inappropriately. – Pieter Goosen Apr 30 '14 at 9:47
  • 1
    You actually have a valid point here. According to what the $crop parameter say, it should be array(left, top), not array(top, left). Can anyone collaborate on this? – Pieter Goosen Apr 30 '14 at 19:34
  • Just a note to the moderators, I've added the tag wordpress.org as this is codex related question that I feel is valid, check my previous comment – Pieter Goosen Apr 30 '14 at 19:38
3

As @PieterGoosen said, your point is valid. A look into the source confirms that the codex description of add_image_size was wrong there. It was, because I changed it to be correct. That said, everyone can help improving the codex, you just need to register. You might want to take a look at Contributing to WordPress for a introduction on how to do that, the first section is about the documentation aka codex.

| improve this answer | |
  • Ok. Thanks a lot! I would probably register for improving the codex as well. – bestprogrammerintheworld May 1 '14 at 12:02
  • Thanks for clearing this up, I wasn't hundred percent sure. +1 for this and the extra info you provided – Pieter Goosen May 1 '14 at 12:59
  • 1
    My pleasure, I guess I was just a little bit quicker. Besides that, this just proofs once gain the beauty of open information collaborating systems. @bestprogrammerintheworld – Nicolai May 1 '14 at 17:36
  • @PieterGoosen Sure thing, this just made me curious, so took a closer look. Otherwise the same as I said in the previous comment..don't want to repeat myself here. – Nicolai May 1 '14 at 17:40
  • HAHAHA Understood! – Pieter Goosen May 1 '14 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.