Resize Images To Fit Screen

Started by slinouille, April 13, 2009, 01:43:14 PM

Previous topic - Next topic

cityeyes

#20
Quote from: ALEJO on April 19, 2009, 09:23:34 PM
Hi, im having this problem*see picture below - the pic its like compressed vertically*. (15" monitor at 1280x800)
This seems to have problems with the resoultion because with 1280x1024 it works fine, so if you can help me i would be thankful.

One of my users is having this same problem. So far, all I know is that he's running IE7. It also happens when I browse to the site on my cell phone (although that's not a big deal given the fact I only did it for experimental purposes).

I don't know if it has to do with the resolution of the user or the browser or what.

Edit: I think it's IE7. I switched my resolution to 1280x800 and ran my website on both IE8 and Firefox with no problems whatsoever. The guy having the problem in my forum is using IE7.

butchs

Any chance of having the image resize working when you "View the most recent posts on the forum"?

:)
I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

ih8pavement

I thought this mod was working perfectly, but I am having the proportion problem.

My resolution is 1920x1200, and I'm running the same browser as my wife (IE 8.0.6001.18828).  The resolution on the other computer is 1280x800 I think.

On Google Chrome and Mozill Firefox it works fine.  For IE I have to make the window pretty small before it's the correct ratio.

Thanks!

adbrad

does any one have working on rc 2 thanks

HorTs

I too am having the problem with Internet Explorer and the vertically squashed images.

sattninja

thanks man worked great on RC2

straight install
good job great mod
Running Rc4

nikan

Modifications to work on 1.1.11

Copy imagefit.jquery.js and imagefit.jquery.library.js to default theme directory and edit the following files

Sources/Load.php
Find:
// This determines the server... not used in many places, except for login fixing.

Add before:
//ResizeImagesToFitScreen mod
if ( isset($modSettings['enable_imageFit_mod']) && !empty($modSettings['enable_imageFit_mod']) ) {
//Load jQuery library
if ( empty($jQueryLoaded) || $jQueryLoaded != true ){
    $jQueryLoaded = true; //indicates that jQuery is loaded. This to prevent against several loadings of jquery.js
    $context['html_headers'] .= '
<script language="JavaScript" type="text/javascript" src="'. $settings['default_theme_url']. '/imagefit.jquery.js"></script>';
}
//Use JQuery in NoConflict mode => change $ by JQ
$context['html_headers'] .= '
<script language="JavaScript" type="text/javascript" src="'. $settings['default_theme_url']. '/imagefit.jquery.library.js"></script>
    <script language="JavaScript" type="text/javascript">
        if ( JQ == undefined) var JQ = jQuery.noConflict();
    </script>';
//Prepare options
if (isset($modSettings['imageFit_container']) && !empty($modSettings['imageFit_container'])) $imageFit_container = $modSettings['imageFit_container'];
else $imageFit_container = "#forumposts";
if (isset($modSettings['imageFit_included']) && !empty($modSettings['imageFit_included'])) $imageFit_included = 'elements_included:"'.$modSettings['imageFit_included'].'"';
else $imageFit_included = "";
if ( !empty($imageFit_excluded) ) $imageFit_options = "{".$imageFit_excluded."}";
else $imageFit_options = "";

$context['html_headers'] .= '
<script language="JavaScript" type="text/javascript" src="'. $settings['default_theme_url']. '/imagefit.jquery.library.js"></script>
<script language="JavaScript" type="text/javascript">
jQuery(window).load(function(){
  jQuery("'.$imageFit_container.'").imagefit('.$imageFit_options.');
});
</script>';
}
//End mod



Sources/ModSettings.php
Find:
// Width/Height image reduction.
array('int', 'max_image_width'),
array('int', 'max_image_height'),


Add after:
array('check', 'enable_imageFit_mod'),
array('text', 'imageFit_container','30'),
array('text', 'imageFit_included','50'),



Sources/Subs.php
Find:
'content' => '<img src="$1" alt="{alt}"{width}{height} border="0" />',
'validate' => create_function('&$tag, &$data, $disabled', '
$data = strtr($data, array(\'<br />\' => \'\'));
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
'disabled_content' => '($1)',
),
array(
'tag' => 'img',
'type' => 'unparsed_content',
'content' => '<img src="$1" alt="" border="0" />',


Replace with:
'content' => '<img src="$1" alt="{alt}"{width}{height} class="bbc_img" />',
'validate' => create_function('&$tag, &$data, $disabled', '
$data = strtr($data, array(\'<br />\' => \'\'));
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
'disabled_content' => '($1)',
),
array(
'tag' => 'img',
'type' => 'unparsed_content',
'content' => '<img src="$1" alt="" class="bbc_img" />',



Themes/default/style.css
Add at the end:
.bbc_img
{
border: 0;
}



Then in Admin -> Features and Options -> [ImageFit] Optional: enter reference container id/class of your theme field enter: .post

Joker™

thanx a lot man......mod got installed straight forward on RC2
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

MaXiForum.cz

It´s very nice modification.
Thank you!

Neverhurry

Quote from: sattninja on January 18, 2010, 12:18:38 PM
thanks man worked great on RC2

straight install
good job great mod

I use RC2 and I installed this mod but it doesn't do any resize to fit the screen.
I am using SMF 2.0.1, curve themes.

Joker™

Quote from: neverhurry on February 06, 2010, 03:12:35 PM
Quote from: sattninja on January 18, 2010, 12:18:38 PM
thanks man worked great on RC2

straight install
good job great mod

I use RC2 and I installed this mod but it doesn't do any resize to fit the screen.

i wont work on images prior to the installation .... to test it get a big image n try to make the post

see the result urself ;)
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Neverhurry

Quote from: sid2varun on February 06, 2010, 03:16:12 PM
Quote from: neverhurry on February 06, 2010, 03:12:35 PM
Quote from: sattninja on January 18, 2010, 12:18:38 PM
thanks man worked great on RC2

straight install
good job great mod

I use RC2 and I installed this mod but it doesn't do any resize to fit the screen.

i wont work on images prior to the installation .... to test it get a big image n try to make the post

see the result urself ;)

No, i tried it, but it doesn't work. Very strange. But thank you man.
I am using SMF 2.0.1, curve themes.

nikan

I have updated the mod to latest jQuery v1.4.2 and added hack to solve the proportion problem with IE
The package is for SMF 2.0 RC2 and SMF 1.1.11

MaXiForum.cz


neo2504

great mod, can someone update it for RC3???

adbrad

Quote from: neo2504 on April 08, 2010, 08:26:31 AM
great mod, can someone update it for RC3???

have you tried to install it on rc3 if you read the first post it says
QuoteThis mod is compatible with SMF 2.0 RC1 Public and above only.
which means it should work with any version after that one

vgnapply

#36
Hello,

I've installed the version modified by Nikan and works like a dream, but i have a question, is there anyway to open the original size image clicking on the resized one? like the nCode does

thanks in advance

SSVertigo

Hi, i need some help, this mod is working perfect with posted images, but in the reply page, the posted images still big.
Using SMF 2.0 RC3.

forum: hxxp:www.lbsh.com.br [nonactive]

Salkiri

I have this mod along with Highslide 4 SMF http://custom.simplemachines.org/mods/index.php?mod=2518 and it's working perfect as desired on SMF 2.0RC3.

It's handling existing large images perfectly. 

Thank you.

Salkiri

Tried to install ENotify Mod (http://custom.simplemachines.org/mods/index.php?mod=2198) and it breaks this mod.

This is the error I get:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; GTB0.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.30729; .NET CLR 3.5.30729; InfoPath.1; InfoPath.2; OfficeLiveConnector.1.4; OfficeLivePatch.1.3)
Timestamp: Wed, 19 May 2010 19:36:02 UTC


Message: Object doesn't support this property or method
Line: 34
Char: 7
Code: 0


This is what is on Line 34: jQuery("#forumposts").imagefit();

Any help on getting these to mods working together would be great.

Advertisement: