I have these prefixes

  • _100;
  • _200.
  • _300.

and have these styles:

  • image_auto;
  • image_100 is not set [not needed];
  • image_200.
  • image_300.

Default responsive prefix is _auto. After resizing of window (for example, 240px) supposed to apply _100 prefix but it not found. It would be nice if applied existed prefix (best fit) or default prefix.

Comments

attiks’s picture

Category: support » feature
Priority: Major » Normal

This is indeed not supported, the easy fix is to define image_100 the same as either image_auto or image_200. The problem with automating this is that it will depend on the particular use case.

Changing to feature request so I can think about it for a couple of days.

blod12312’s picture

In my case, if I define 5 suffixes and assume 3 types of styles (sidebar_*, content_* and the gallery_*), then I'll have to create 15 styles of images. It will take quite some time.

I think the quick solution is in function resp_img_get_best_suffix, where you need to check the appropriate style prefixes for existence and to choose the right.

Thank you. I'll wait for your solution.

attiks’s picture

@emit.it3 i know it's a lot right now to do by hand, I'm going to add a form that will duplicate styles so you can select an existing image style and it will duplicate it for all defined suffixes, but i need to find the time ...

attiks’s picture

Assigned: Unassigned » jelle_s
jelle_s’s picture

In the latest dev version you can now go to admin/config/media/resp_img/create_style and add responsive styles in a more user friendly manner

jelle_s’s picture

Status: Active » Fixed

The thing is that this module relies on all the styles (one for each suffix) being present. The actual functionality boils down to this function:

/**
 * Replace suffix if needed / possible
 */
function resp_img_replace_suffix($path) {
  $bestfit_suffix = resp_img_get_best_suffix();
  $default_suffix = variable_get('resp_img_default_suffix', '');

  if (isset($bestfit_suffix) && !empty($bestfit_suffix) && $bestfit_suffix != $default_suffix) {
    $path = str_replace($default_suffix, $bestfit_suffix, $path);
  }
  return $path;
}

which basically does a string replace of the default suffix with the suffix that is best for the current window with.

Because it's just a string replace, we can't check if that image style actually exists...
Marking this as fixed (because of the easier way you can now add image styles).

blod12312’s picture

Thanks.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

Some mistakes.