import { get } from 'lodash/object';

export default (size = 0, attrs = {}) => (
  size ? {
    w: parseInt(size, 10),
    h: get(attrs, 'h', attrs.height)
      ? (parseInt(size, 10) / parseInt(get(attrs, 'w', attrs.width), 10)) * parseInt(get(attrs, 'h', attrs.height), 10)
      : ''
  } : {}
);

import { get } from 'lodash/object';
import { round } from 'lodash/math';

export default (size = 0, attrs = {}) => (
  size ? {
    w: parseInt(size, 10),
    h: get(attrs, 'h', attrs.height)
      ? round(parseInt(size, 10) / parseInt(get(attrs, 'w', attrs.width), 10)) * parseInt(get(attrs, 'h', attrs.height), 10)
      : ''
  } : {}
);

Fix decimal image with on request
Fix decimal image with on request
