ng-image-slider icon indicating copy to clipboard operation
ng-image-slider copied to clipboard

Override image size with imageSize property on each image

Open MrSuttonmann opened this issue 5 years ago • 6 comments

Hello,

I would like to use your slider to display some images, however these images are not all uniform widths. They are the same height however.

I have set a default height on the component:

<ng-image-slider
          ...
          [imageSize]="{height: 100}"
        ></ng-image-slider>

... and set each image width on the image object:

{
      ...
      imageSize: {
        width: 200
      }
}

The images are still all the same width. Unless this can be fixed or support added unfortunately it seems using this slider is a deal-breaker for me.

MrSuttonmann avatar Feb 14 '20 14:02 MrSuttonmann

Hi @plinkpaste This is happening because I am using fix width and height for all images (whatever receive from @input [imageSize] or default {width: 205, height: 200}.

will it be helpful for you If I receive each image width/height from [images] @input something like

{
    image: 'assets/img/slider/1.jpg',
    thumbImage: 'assets/img/slider/1_min.jpeg',
    width: '200px'
    height: '315px'
}

OR do you have any other suggestion?

sanjayV avatar Feb 15 '20 17:02 sanjayV

I like your suggestion, and that would be really useful.

I would suggest one slight change to your code though:

{
    image: 'assets/img/slider/1.jpg',
    thumbImage: 'assets/img/slider/1_min.jpeg',
    imageSize: {
        width: '200px'
        height: '315px'
    }
}

If either the height or width is undefined, then it can use the @Input imageSize or default.

MrSuttonmann avatar Feb 17 '20 09:02 MrSuttonmann

Would it maybe be possible to keep the aspect ratio? Just set the height and get the correspondending with. Or if the width needs to be set due to your calculations keeping the height would be pretty cool!

ghost avatar Jun 23 '20 15:06 ghost

Has this option been implemented yet? It would be very useful for my project and is the only reason that I cannot use it right now.

WTIGER001 avatar Jan 04 '21 17:01 WTIGER001

@sanjayV I am no longer requiring this change as I have since changed employment, however it seems there are others interested. Do you have any update for them? Many thanks.

MrSuttonmann avatar Feb 09 '21 08:02 MrSuttonmann

@sanjayV, any update on this? I would love to have imageSize option as all of my images are of different sizes as well.

pavanteja90 avatar Apr 23 '21 22:04 pavanteja90