Is there a way to configure resizing in the browser?
Nista
Joined: 2009-04-05
Posts: 9 |
![]() |
Hi Everyone, I'd like my images to be re-sized in the browser based on screen resolution. |
|
nivekiam
![]()
Joined: 2002-12-10
Posts: 16504 |
![]() |
EDIT: Sorry wrong thread.... To answer your question. I'm sure it can be done with javascript, just don't know how to go about it off the top of my head. What size image do you want to resize to the browser size? The thumbs? Resize? Full size only? ____________________________________________ |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
$('img').css({'width':parseInt($('img').width()*.50), 'height': 'auto'}); -s |
|
Nista
Joined: 2009-04-05
Posts: 9 |
![]() |
Thanks for the response, to clarify, I'd like the browser to be able to re-size the 900x600 image that is normally returned (not the full size one produced by the double square icon). |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
In my gallery embed template (I mainly use it for playing around) I check the viewport size and adjust the number of rows & columns depending on the size.(resize the window and watch it reconfigure itself) But for me to post further script, I'd need to know more specifics like what size image vs. what size viewport AND BTW if you have gallery build a smaller resize like 640px it would display that first before the 900px image. As seen again in my sample. |
|
Nista
Joined: 2009-04-05
Posts: 9 |
![]() |
Hi Suprsidr, I don't find a embed template in my gallery directories and your sample link doesn't work, but looking at the embed template.. that's exactlt what I'd like to do just for image size. I'm using the stock gallery 2 distro, version 2.2.5. |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
at the bottom of gallery2/themes/carbon/templates/local/theme.tpl <- you may have to copy the original here </body> </html> add: {literal}<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script> <script> $(function(){ $("#gsImageView img").css({'height': parseInt($(window).height() - 240), 'width': 'auto'}); window.onresize = function(){ $("#gsImageView img").css({ 'height': parseInt($(window).height() - 240), 'width': 'auto' }); } }); </script>{/literal} Clear your template cache and test. -s |
|
Nista
Joined: 2009-04-05
Posts: 9 |
![]() |
Thanks much, but when I add the script I get a blank page and I don't see any errors in the apache logs. Nista |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
Ah yes, I forgot we were inserting into a smarty template. -s |
|
Nista
Joined: 2009-04-05
Posts: 9 |
![]() |
It looks like it works! |
|
HappyMini
Joined: 2011-05-21
Posts: 6 |
![]() |
Sorry to bump this old topic, but I got a question about it. Is there any way to set a max size? So the smaller images won't get blurry? |
|