liongold Posted March 19, 2014 Share Posted March 19, 2014 I am currently building an image viewer something like a Gallery. However, I need to work with several images of different sizes. The viewer currently puts the image in a div and sets the background as a background image. I currently use this CSS code: background: url() no-repeat center cover Link to comment https://forums.phpfreaks.com/topic/287086-image-viewer/ Share on other sites More sharing options...
rx3mer Posted March 19, 2014 Share Posted March 19, 2014 background-size: 100% 100%; Or http://css-tricks.com/how-to-resizeable-background-image/ Link to comment https://forums.phpfreaks.com/topic/287086-image-viewer/#findComment-1473233 Share on other sites More sharing options...
otuatail Posted March 21, 2014 Share Posted March 21, 2014 Is this all you are trying to do? <img src="images/me.jpg" alt="my picture" width="300px"> This would make the width the same but the aspect ratio of the photos would affect the height and not all digital cameras have the same 1:1.5 ratio Link to comment https://forums.phpfreaks.com/topic/287086-image-viewer/#findComment-1473435 Share on other sites More sharing options...
liongold Posted March 21, 2014 Author Share Posted March 21, 2014 I don't think I explained myself well. What I want to do is "copy" what Google Chrome does. If the image can fit the div as it is, leave it like that. However, if the image is too big for the div make the div 'resize' the image to make it fit (cover does this right now). Link to comment https://forums.phpfreaks.com/topic/287086-image-viewer/#findComment-1473479 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.