[TIP] HighSlide for rescaled inline images

Started by Feline, 2011 December 29, 02:50:06 pm

previous topic - next topic

0 Members and 1 Guest are viewing this topic.

Feline

*
2011 December 29, 02:50:06 pm Last Edit: 2012 January 03, 12:18:54 am by feline
With two small changes you can use the PortaMx HighSlide for rescaled (smaller) inline images (img tags).
Step 1.. Open the file /Sources/Subs.php and find (~ Line 1269)
Code Select

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


Replace with:
Code Select

'content' => '<a href="$1" class="highslide" title="Click to enlarge" onclick="return hs.expand(this, {align: \'center\', headingEval: \'this.thumb.alt\'})"><img src="$1" alt="{alt}"{width}{height} class="bbc_img resized" /></a>',
'validate' => create_function('&$tag, &$data, $disabled', '
$data = strtr($data, array(\'<br />\' => \'\'));
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),


Step 2.. Open the file /Themes/default/scripts/theme.js and find (~ Line 39)
Code Select

// Add a load event for the function above.
addLoadEvent(smc_toggleImageDimensions);


Replace with:
Code Select

// Add a load event for the function above.
// addLoadEvent(smc_toggleImageDimensions);


AdminNow go to Admin - Features and Options - Layout:

Set Max width of posted pictures and Max height of posted pictures to a smaller value, as example 200

Now all NEW inserted images are resized to 200px and can expand in HighSlide with a click on the image.
For exiting images in topics, edit the topic and save it again (without any change).
Many are stubborn in relation to the way, but less in relation to the target.

agent47

*
#1
2012 January 25, 03:15:30 pm
This is pretty damn awesome! Love it! Thanks a load feline.

zeum

*
#2
2013 September 14, 06:06:57 am
How would i go about doing this... But for YouTube videos. The videos don't auto-fit themselves... So you cannot see the full video. I'd like to make the video Auto-Fit to the custom size of the Panel.

* Shouts

Feline
2018 Aug. 21, 08:10:46 pm
Today we update our Forum to the Version 1.45
Feline
2018 Jun. 09, 07:54:13 pm
Today we update our Forum to Version 1.4
This release is full compatible with the EU GDPR
Feline
2018 Mar. 28, 11:56:21 am
Update for PortaMx 1.54 ecl released.
With this updates the Portal works with PHP 7.x and SMF 2.0.15
Feline
2018 Mar. 17, 10:35:03 pm
PortaMx Forum 1.3
released !

*
Feline
2017 Dec. 10, 04:30:54 am
Today we switched to PHP 7.2 and activate Opcode caching.
Fast .. Very fast *
Feline
2017 Mar. 03, 11:54:35 pm
Today we upgrade our old SMF 2.0 Forum to PortaMx Forum *

* Calendar

Su
Mo
Tu
We
Th
Fr
Sa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
HolidaysDec 16: 3. Advent (de)