nCode Image Resizer

Started by vbgamer45, May 18, 2008, 01:43:55 PM

Previous topic - Next topic

maglix04

Hi, the mod isn't compatible with the current version of smf 2.0.17. Possible upgrade?
Thanks.

vbgamer45

Try to install and see if you get errors. If no errors then it would work.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

maglix04

When I try to install it, it gives me this error in the file sources/subs.php:

Code (find) Select

array(
'tag' => 'img',
'type' => 'unparsed_content',
'parameters' => array(
'alt' => array('optional' => true),
'width' => array('optional' => true, 'value' => ' width="$1"', 'match' => '(\d+)'),
'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
),
'content' => '<img src="$1" alt="{alt}"{width}{height} class="bbc_img resized" />',
'validate' => function (&$tag, &$data, $disabled)
{
global $image_proxy_enabled, $image_proxy_secret, $boardurl;

$data = strtr($data, array('<br>' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = 'http://' . $data;

if (substr($data, 0, 8) != 'https://' && $image_proxy_enabled)
$data = $boardurl . '/proxy.php?request=' . urlencode($data) . '&hash=' . md5($data . $image_proxy_secret);
},
'disabled_content' => '($1)',
),
array(
'tag' => 'img',
'type' => 'unparsed_content',
'content' => '<img src="$1" alt="" class="bbc_img" />',
'validate' => function (&$tag, &$data, $disabled)
{
global $image_proxy_enabled, $image_proxy_secret, $boardurl;

$data = strtr($data, array('<br>' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = 'http://' . $data;

if (substr($data, 0, 8) != 'https://' && $image_proxy_enabled)
$data = $boardurl . '/proxy.php?request=' . urlencode($data) . '&hash=' . md5($data . $image_proxy_secret);
},
'disabled_content' => '($1)',
),




Code (replace) Select

array(
'tag' => 'img',
'type' => 'unparsed_content',
'parameters' => array(
'alt' => array('optional' => true),
'width' => array('optional' => true, 'value' => ' width="$1"', 'match' => '(\d+)'),
'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
),
'content' => '<img src="$1" alt="{alt}"{width}{height} border="0" onload="NcodeImageResizer.createOn(this);" class="bbc_img" />',
'validate' => function (&$tag, &$data, $disabled)
{
global $image_proxy_enabled, $image_proxy_secret, $boardurl;

$data = strtr($data, array('<br>' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = 'http://' . $data;

if (substr($data, 0, 8) != 'https://' && $image_proxy_enabled)
$data = $boardurl . '/proxy.php?request=' . urlencode($data) . '&hash=' . md5($data . $image_proxy_secret);
},
'disabled_content' => '($1)',
),
array(
'tag' => 'img',
'type' => 'unparsed_content',
'content' => '<img src="$1" alt="" border="0" onload="NcodeImageResizer.createOn(this);" class="bbc_img" />',
'validate' => function (&$tag, &$data, $disabled)
{
global $image_proxy_enabled, $image_proxy_secret, $boardurl;

$data = strtr($data, array('<br>' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = 'http://' . $data;

if (substr($data, 0, 8) != 'https://' && $image_proxy_enabled)
$data = $boardurl . '/proxy.php?request=' . urlencode($data) . '&hash=' . md5($data . $image_proxy_secret);
},
'disabled_content' => '($1)',
),







When I try to replace the code manually, I realized that the original code to be replaced is different:
Code (orginal code) Select



  'tag' => 'img',
'type' => 'unparsed_content',
'parameters' => array(
'alt' => array('optional' => true),
'width' => array('optional' => true, 'value' => ' width="$1"', 'match' => '(\d+)'),
'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
),
'content' => '<img src="$1" alt="{alt}"{width}{height} class="bbc_img resized" />',
'validate' => function (&$tag, &$data, $disabled)
{
$data = strtr($data, array('<br>' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = 'http://' . $data;

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

$data = get_proxied_url($data);
},





In the original code there aren't these lines:

'validate' => function (&$tag, &$data, $disabled)
{
global $image_proxy_enabled, $image_proxy_secret, $boardurl;



But this:
'validate' => function (&$tag, &$data, $disabled)
{
$data = strtr($data, array('<br>' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = 'http://' . $data;

$data = get_proxied_url($data);




So I stopped myself from editing manually because I'm afraid of making a mistake. I have smf 2.0.17.

vbgamer45

Looks like it has to be updated.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

maglix04

Quote from: vbgamer45 on January 05, 2020, 11:01:05 AM
Looks like it has to be updated.
So, I hope for an upgrade as soon as possible.
Thank you.

davidhs

Your last version (2.0) added support for SMF 1.1.x but this not work.

It install only on SMF 2.0 to 2.0.15.

vbgamer45

It installed on my test for 1.1.x the package-info.xml has the following in it


<install for="2.0 - 2.0.13">
<modification>install-smf2.xml</modification>
<require-file name="ncode_imageresizer.js" destination="$themedir" />
</install>

<uninstall for="2.0 - 2.0.13">
<modification reverse="true">install-smf2.xml</modification>
<remove-file name="$themedir/ncode_imageresizer.js" />
</uninstall>

<install for="2.0.14-2.0.99">
<modification>install-smf2.0.14.xml</modification>
<require-file name="ncode_imageresizer.js" destination="$themedir" />
</install>

<uninstall for="2.0.14-2.0.99">
<modification reverse="true">install-smf2.0.14.xml</modification>
<remove-file name="$themedir/ncode_imageresizer.js" />
</uninstall>

<install for="1.1-1.1.99">
<readme>readme.txt</readme>
<modification>install-smf1.xml</modification>
<require-file name="ncode_imageresizer.js" destination="$themedir" />
</install>
<uninstall for="1.1-1.1.99">
<modification reverse="true">install-smf1.xml</modification>
<remove-file name="$themedir/ncode_imageresizer.js" />
</uninstall>
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

davidhs

Quote from: vbgamer45 on March 07, 2020, 01:24:45 PM
It installed on my test for 1.1.x the package-info.xml has the following in it


<install for="2.0 - 2.0.13">
<modification>install-smf2.xml</modification>
<require-file name="ncode_imageresizer.js" destination="$themedir" />
</install>

<uninstall for="2.0 - 2.0.13">
<modification reverse="true">install-smf2.xml</modification>
<remove-file name="$themedir/ncode_imageresizer.js" />
</uninstall>

<install for="2.0.14-2.0.99">
<modification>install-smf2.0.14.xml</modification>
<require-file name="ncode_imageresizer.js" destination="$themedir" />
</install>

<uninstall for="2.0.14-2.0.99">
<modification reverse="true">install-smf2.0.14.xml</modification>
<remove-file name="$themedir/ncode_imageresizer.js" />
</uninstall>

<install for="1.1-1.1.99">
<readme>readme.txt</readme>
<modification>install-smf1.xml</modification>
<require-file name="ncode_imageresizer.js" destination="$themedir" />
</install>
<uninstall for="1.1-1.1.99">
<modification reverse="true">install-smf1.xml</modification>
<remove-file name="$themedir/ncode_imageresizer.js" />
</uninstall>

You have only one install-smf1.xml for all SMF 1.1-1.1.99 and code of /Sources/Subs.php is changed in different versions:

Code (SMF 1.1-1.1.10) Select
<?php

array(
'tag' => 'img',
'type' => 'unparsed_content',
'content' => '<img src="$1" alt="" border="0" />',
'validate' => create_function('&$tag, &$data, $disabled''$data = strtr($data, array(\'<br />\' => \'\'));'),
'disabled_content' => '($1)',
),

?>

Code (SMF 1.1.11-1.1.21) Select
<?php

array(
'tag' => 'img',
'type' => 'unparsed_content',
'content' => '<img src="$1" alt="" 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)',
),

?>


By other hand you search this (with || instead of &&):
Code (install-smf1.xml) Select

<file name="$sourcedir/Subs.php">
<operation>
<search position="replace"><![CDATA[array(
'tag' => 'img',
'type' => 'unparsed_content',
'content' => '<img src="$1" alt="" 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)',
),]]></search>


Are you sure can install?

I tested with your last update: nCode_Image_Resizer2.0.zip

vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

maglix04

Quote from: vbgamer45 on March 15, 2020, 10:02:45 PM
Fixed for SMF 1.1.21
Sorry, the fix also concern the problem I reported?




Quote from: maglix04 on January 05, 2020, 04:12:20 AM
When I try to install it, it gives me this error in the file sources/subs.php:

Code (find) Select

array(
'tag' => 'img',
'type' => 'unparsed_content',
'parameters' => array(
'alt' => array('optional' => true),
'width' => array('optional' => true, 'value' => ' width="$1"', 'match' => '(\d+)'),
'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
),
'content' => '<img src="$1" alt="{alt}"{width}{height} class="bbc_img resized" />',
'validate' => function (&$tag, &$data, $disabled)
{
global $image_proxy_enabled, $image_proxy_secret, $boardurl;

$data = strtr($data, array('<br>' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = 'http://' . $data;

if (substr($data, 0, 8) != 'https://' && $image_proxy_enabled)
$data = $boardurl . '/proxy.php?request=' . urlencode($data) . '&hash=' . md5($data . $image_proxy_secret);
},
'disabled_content' => '($1)',
),
array(
'tag' => 'img',
'type' => 'unparsed_content',
'content' => '<img src="$1" alt="" class="bbc_img" />',
'validate' => function (&$tag, &$data, $disabled)
{
global $image_proxy_enabled, $image_proxy_secret, $boardurl;

$data = strtr($data, array('<br>' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = 'http://' . $data;

if (substr($data, 0, 8) != 'https://' && $image_proxy_enabled)
$data = $boardurl . '/proxy.php?request=' . urlencode($data) . '&hash=' . md5($data . $image_proxy_secret);
},
'disabled_content' => '($1)',
),




Code (replace) Select

array(
'tag' => 'img',
'type' => 'unparsed_content',
'parameters' => array(
'alt' => array('optional' => true),
'width' => array('optional' => true, 'value' => ' width="$1"', 'match' => '(\d+)'),
'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
),
'content' => '<img src="$1" alt="{alt}"{width}{height} border="0" onload="NcodeImageResizer.createOn(this);" class="bbc_img" />',
'validate' => function (&$tag, &$data, $disabled)
{
global $image_proxy_enabled, $image_proxy_secret, $boardurl;

$data = strtr($data, array('<br>' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = 'http://' . $data;

if (substr($data, 0, 8) != 'https://' && $image_proxy_enabled)
$data = $boardurl . '/proxy.php?request=' . urlencode($data) . '&hash=' . md5($data . $image_proxy_secret);
},
'disabled_content' => '($1)',
),
array(
'tag' => 'img',
'type' => 'unparsed_content',
'content' => '<img src="$1" alt="" border="0" onload="NcodeImageResizer.createOn(this);" class="bbc_img" />',
'validate' => function (&$tag, &$data, $disabled)
{
global $image_proxy_enabled, $image_proxy_secret, $boardurl;

$data = strtr($data, array('<br>' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = 'http://' . $data;

if (substr($data, 0, 8) != 'https://' && $image_proxy_enabled)
$data = $boardurl . '/proxy.php?request=' . urlencode($data) . '&hash=' . md5($data . $image_proxy_secret);
},
'disabled_content' => '($1)',
),







When I try to replace the code manually, I realized that the original code to be replaced is different:
Code (orginal code) Select



  'tag' => 'img',
'type' => 'unparsed_content',
'parameters' => array(
'alt' => array('optional' => true),
'width' => array('optional' => true, 'value' => ' width="$1"', 'match' => '(\d+)'),
'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
),
'content' => '<img src="$1" alt="{alt}"{width}{height} class="bbc_img resized" />',
'validate' => function (&$tag, &$data, $disabled)
{
$data = strtr($data, array('<br>' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = 'http://' . $data;

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

$data = get_proxied_url($data);
},





In the original code there aren't these lines:

'validate' => function (&$tag, &$data, $disabled)
{
global $image_proxy_enabled, $image_proxy_secret, $boardurl;



But this:
'validate' => function (&$tag, &$data, $disabled)
{
$data = strtr($data, array('<br>' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = 'http://' . $data;

$data = get_proxied_url($data);




So I stopped myself from editing manually because I'm afraid of making a mistake. I have smf 2.0.17.

vbgamer45

Will have to check if I added a fix for that. But i dot' believe so
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

davidhs

Quote from: vbgamer45 on March 15, 2020, 10:02:45 PM
Fixed for SMF 1.1.21
Sorry but this not works. I test in SMF 1.1.21 (I do not know in previous versions) and there are two errors in install-smf1.xml
Quote
Code (Search (line 59)) Select
),]></search>
Code (Replace by) Select
),]]></search>

Code (Search (line 66)) Select
if (strpos($data, \'http://\') !== 0 || strpos($data, \'https://\') !== 0)
Code (Replace by) Select
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)

Code (Search (line 79)) Select
<add><![CDATA[echo '<!-- nCode Image Resizer -->
Code (Replace by) Select
<add><![CDATA[<!-- nCode Image Resizer -->

I applied these, and install but... do not work. I do not know what is the problem.

vbgamer45

3.0 Update!
Added support to SMF 2.0.17 thanks to Deaks
Works better on all themes for SMF 2.0.x!
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

cornflakes

Quote from: vbgamer45 on May 24, 2020, 08:39:17 PM
3.0 Update!
Added support to SMF 2.0.17 thanks to Deaks
Works better on all themes for SMF 2.0.x!

Thanks.  So just to confirm, this only works if you use the "insert image" feature ?
I installed the simple image uploader mod where  you upload the photo to a 3rd party server (imgbb) and when
I do that, it just acts normally as that mod.

Also, I noticed when I did the "add image" option and pasted the url link between the code, I set the width in my settings to 600 width so the picture will load in that size, but I don't see the little message on top of the photo that says click here to see full size / original size.   I am able to click the photo and it reloads in the post as the full size and if I click it again it will switch back to the resized size.


vbgamer45

Yes only tested with the insert image feature. Only applies to the img bbc code.
If text is missing make sure it is in your themes Modifications.*.php file where * is the language of the forum.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

cornflakes

Quote from: vbgamer45 on May 26, 2020, 11:36:29 PM
If text is missing make sure it is in your themes Modifications.*.php file where * is the language of the forum.

Sorry, I don't understand.   Is the file called "modifications.english.php" ?
Am I looking the right place? I couldn't find this file.

I am using RDD 2.0.14 theme

vbgamer45

In the languages folder.
If it does not exist that is good!
Then you just have to check your themes/default languages folder.
And make sure this text is in the file

// --- Begin added code - nCode Image Resizer ---
$txt['ncode_imageresizer_warning_small'] = 'Click this bar to view the full image.';
$txt['ncode_imageresizer_warning_filesize'] = 'This image has been resized. Click this bar to view the full image. The original image is sized %1$sx%2$s and weighs %3$sKB.';
$txt['ncode_imageresizer_warning_no_filesize'] = 'This image has been resized. Click this bar to view the full image. The original image is sized %1$sx%2$s.';
$txt['ncode_imageresizer_warning_fullsize'] = 'Click this bar to view the small image.';
$txt['ncode_imageresizer_mode'] = 'Resize Mode';
$txt['ncode_imageresizer_original'] = 'Keep original size';
$txt['ncode_imageresizer_enlarge_same'] = 'Enlarge in same document';
$txt['ncode_imageresizer_open_same'] = 'Open in same window';
$txt['ncode_imageresizer_open_new'] = 'Open in new window';
$txt['ncode_imageresizer_max_width'] = 'Maximum width';
$txt['ncode_imageresizer_max_height'] = 'Maximum height<br /><span class="smalltext">Leave blank for no max height.</span>';
// --- End added code ---
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

cornflakes

thank you, I will see if I can find that.
It's my first time here, just got SMF forum and trying to learn the the basics! ^^

cornflakes

sorry I tried copy and pasting that text you gave in the php, also tried it in the index.css file and I didn't figure it out still.

I'm really confused and not sure what exactly to do.

Here are some screen shots:

(the last two, you can see the picture shows up in the smaller size, but no text that says "click here to make image larger",
but I can click it still and the picture is bigger).




FragaCampos

I installed the latest update and I can confirm that the bar over the resized image appears, but without text.
My Modifications.language.php was correctly edited and I don't have a clue why this happens. Any thoughts?

Advertisement: