A patch to improve speed, ad functionality, and fix bugs.

Solves the following issues..could not post in separate patches because the code in question was all lumped together.

Image style derivative is always generated, even if available
https://www.drupal.org/node/2611470

Support for relative path
https://www.drupal.org/node/2853035

Token for mimetype will never get created for images
https://www.drupal.org/node/2853027

token for image derivate path appends "%3Apath" to image style name part of url
https://www.drupal.org/node/2744265

Image style derivative not create when using first, second, third tokens
https://www.drupal.org/node/2853083

Also adds support for 'last' and numerical selection for multivalued fields.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

monstrfolk created an issue. See original summary.

monstrfolk’s picture

Status: Active » Needs review
monstrfolk’s picture

monstrfolk’s picture

Added image style derivatives to be properly created when using first, second, third, last, and integer tokens.

monstrfolk’s picture

Issue summary: View changes
DamienMcKenna’s picture

Status: Needs review » Needs work

A minor thing - the description of each param needs to follow the standard commenting rules, i.e. structured as a sentence, have a period at the end, acronyms should be in uppercase, etc. Otherwise it looks good.

monstrfolk’s picture

FileSize
9.06 KB

Thank you for your review. New description block below.

/**
 * Helper function to generate image style if does not exist.
 *
 * @param string $styled_uri
 *   URI for image style.
 * @param string $type
 *   Machine name for image style.
 * @param string $field_uri
 *   URI of field to be styled.
 */

Also added one small fix to check if index selected for multi-value fields exist.

monstrfolk’s picture

FileSize
9.06 KB

Uploaded patch again for testing. Last patch was uploaded with testing off by accident.

monstrfolk’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 8: provide_a_public-2511742-7.patch, failed testing.

monstrfolk’s picture

monstrfolk’s picture

Status: Needs work » Needs review

  • monstrfolk committed 67230de on 7.x-1.x
    Issue #2853037 by monstrfolk, DamienMcKenna: Rewrite logic of tokens to...
monstrfolk’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

anni’s picture

I applied the patch but the problem is still the same. The code now is: $output[] = image_style_url($type, $field['uri']); at line 265 but still I get %3Apath inserted.

anni’s picture

Suddenly it works.