Hi @all,

the picture mapping export code should definetely be cleaned up, so unnecessary values do not blow up everything.

Right now we have something like this for just one breakpoint with two multipliers:

$picture_mapping->mapping = array(
    'kk' => array(
      '1x' => array(
        'mapping_type' => 'image_style',
        'image_style' => 'kk-team-member-photo-full',
        'sizes' => '',
        'sizes_image_styles' => array(
          'apps_logo' => 0,
          'apps_logo_small' => 0,
          'apps_screenshot' => 0,
          'apps_featured_screenshot' => 0,
          'focal_point_preview' => 0,
          'thumbnail' => 0,
          'medium' => 0,
          'large' => 0,
          'media_thumbnail' => 0,
          'kk-team-member-photo-full-lg' => 0,
          'kk-team-member-photo-full-md' => 0,
          'kk-team-member-photo-full-sm' => 0,
          'kk-team-member-photo-full' => 0,
          'kk-team-member-photo-full-xs' => 0,
          '_empty image_' => 0,
          '_original image_' => 0,
        ),
      ),
      '1.5x' => array(
        'mapping_type' => '_none',
        'image_style' => '',
        'sizes' => '',
        'sizes_image_styles' => array(
          'apps_logo' => 0,
          'apps_logo_small' => 0,
          'apps_screenshot' => 0,
          'apps_featured_screenshot' => 0,
          'focal_point_preview' => 0,
          'thumbnail' => 0,
          'medium' => 0,
          'large' => 0,
          'media_thumbnail' => 0,
          'kk-team-member-photo-full-lg' => 0,
          'kk-team-member-photo-full-md' => 0,
          'kk-team-member-photo-full-sm' => 0,
          'kk-team-member-photo-full' => 0,
          'kk-team-member-photo-full-xs' => 0,
          '_empty image_' => 0,
          '_original image_' => 0,
        ),
      ),
      '2x' => array(
        'mapping_type' => '_none',
        'image_style' => '',
        'sizes' => '',
        'sizes_image_styles' => array(
          'apps_logo' => 0,
          'apps_logo_small' => 0,
          'apps_screenshot' => 0,
          'apps_featured_screenshot' => 0,
          'focal_point_preview' => 0,
          'thumbnail' => 0,
          'medium' => 0,
          'large' => 0,
          'media_thumbnail' => 0,
          'kk-team-member-photo-full-lg' => 0,
          'kk-team-member-photo-full-md' => 0,
          'kk-team-member-photo-full-sm' => 0,
          'kk-team-member-photo-full' => 0,
          'kk-team-member-photo-full-xs' => 0,
          '_empty image_' => 0,
          '_original image_' => 0,
        ),
      ),
    ),
);

Apparently the most code is just junk we do not really need to describe our mapping. The most of it may be ignored, so only the information that is really necessary gets exported like this:

$picture_mapping->mapping = array(
    'kk' => array(
      '1x' => array(
        'mapping_type' => 'image_style',
        'image_style' => 'kk-team-member-photo-full',
      ),
      '1.5x' => array(
        'mapping_type' => '_none',
      ),
      '2x' => array(
        'mapping_type' => '_none',
      ),
    ),
);

... and this is just an example with not so many image styles available... Just imagine you have >= 20 image styles on your site and all of these are added in the sizes_image_styles array for every breakpoint and every multiplier... and just apart from that: This makes exporting in features quite bogus, because you may export image style information you do not use within a feature and they may not be present in another site at all, where you might want to use your feature again.

Does anybody see problems with this feature request? If not, I would take the time and build a patch to get this done...

I'd appreciate your feedback, thanx in advance & best regards

hctom

Comments

attiks’s picture

Good idea, I think it should work, we only need to make sure that it works using features so the imports are still ok.

attiks’s picture

Status: Active » Needs work
jelle_s’s picture

Status: Needs work » Fixed

Fixed in latest dev

  • Commit a0b8bcd on 7.x-2.x by Jelle_S:
    Issue #2279995 by hctom: Added Clean up export.
    

Status: Fixed » Closed (fixed)

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