Toggle Content

Donations

Donate with PayPal!
Help support Pro_News and become a member of our Sponsors Group
The tip jar is at PayPal, but does not require a PayPal account
Anonym $ 10.00
macavity $ 115.00
RedGerry £ 50.00
Anonym $ 10.00
minor $ 20.00

Recommended ISP

Disable Image pop up

For everything else related to Pro_News - tips, tricks, your new ways to use and extend it. A place to exchange ideas and explore future possibilities.
Svara på inläggetSvara på inlägget Utskriftsvänlig sida

Disable Image pop up

Inlägg Skrivet: Tor Mar 18, 2010 7:24 am

Hi is there an easy way to turn the image popup off in articles?

Cheers


_________________

OS: Linux /Apache: 2.2.6 /MySQL: 5.0.45/PHP: 5.2.4 /Dragonfly version: (9.2.1) / Firefox: 3.0.3



Rusty_'s server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.14/5.0.90/5.2.11/Dragonfly (9.2.3.1 CVS)

Rusty_
BetaTester
BetaTester
 
Inlägg: 30
Blev medlem: Feb 06, 2007
Från: Australia

Re: Disable Image pop up

Inlägg Skrivet: Tis Apr 20, 2010 9:27 pm

Sorry, Rusty_, I missed this one entirely.

Yes and no. I really should have the link and the image separate in the template. Problem is that as it has always been a single combined parameter from functions.php, how do I change it now without breaking everyone's own custom templates? (Unless of course we are the only 2 writing any Blinka )

Meantime the easiest way ought to be to simply upload an image that is smaller than the thumbnail size, then there won't be a need to open up a pop-up. Alas the code was not written that way, so some additional code is needed.

Will look at it in the morning - if I don't forget - but basically find this line in article() in functions.php:

PHP:
				    $thumbimage = $pnsettings['imgpath'].'/'.$row['image'];  // Check if thumb exists before linking - layingback 061122

and replace with:

PHP:
				    $thumbimage = $pnsettings['imgpath'].'/'.$row['image'];  // Check if thumb exists before linking - layingback 061122
$nothumb = '1';


and then replace:

PHP:
				$display_image = '<a href="'.$pnsettings['imgpath'].'/'.$row['image'].'" target="'.$target.'"
onclick="PN_openBrWindow(\''
.$BASEHREF.$pnsettings['imgpath'].'/'.$row['image'].'\',\''.$target.'\',\'resizable=yes,scrollbars=no,width='.$imagesizeX.',height='.$imagesizeY.'\',\''.$imagesizeX.'\',\''.$imagesizeY.'\');return false;"><img class="pn_image" src="'.$thumbimage.'" alt="'.$row['caption'].'" /></a>';

with something like:

PHP:
				if ($nothumb) {
$display_image = '<img class="pn_image" src="'.$thumbimage.'" alt="'.$row['caption'].'" />';
} else {
$display_image = '<a href="'.$pnsettings['imgpath'].'/'.$row['image'].'" target="'.$target.'"
onclick="PN_openBrWindow(\''
.$BASEHREF.$pnsettings['imgpath'].'/'.$row['image'].'\',\''.$target.'\',\'resizable=yes,scrollbars=no,width='.$imagesizeX.',height='.$imagesizeY.'\',\''.$imagesizeX.'\',\''.$imagesizeY.'\');return false;"><img class="pn_image" src="'.$thumbimage.'" alt="'.$row['caption'].'" /></a>';
}



And repeat for image2, and blocks, and preview, and ...

Not tested yet though!



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.32 / 1.3.39 - 2.2.12 / 4.4.7 - 5.1.37 / 5.3.0 / 9.2.1

layingback
Site Admin
Site Admin
 
Inlägg: 1229
Blev medlem: Mar 18, 2006

Re: Disable Image pop up

Inlägg Skrivet: Ons Apr 21, 2010 9:49 am

The code in post above should work, but here's a better, cleaner solution.

In functions.php in the article() function look for:

PHP:
				if ($imagesize[0] > $pnsettings['max_w'] || $imagesize[1] > $pnsettings['max_h']) {
$thumbimage = $pnsettings['imgpath'].'/thumb_'.$row['image'];
} else {
$thumbimage = $pnsettings['imgpath'].'/'.$row['image']; // Check if thumb exists before linking - layingback 061122
}
$display_image = '<a href="'.$pnsettings['imgpath'].'/'.$row['image'].'" target="'.$target.'"
onclick="PN_openBrWindow(\''
.$BASEHREF.$pnsettings['imgpath'].'/'.$row['image'].'\',\''.$target.'\',\'resizable=yes,scrollbars=no,width='.$imagesizeX.',height='.$imagesizeY.'\',\''.$imagesizeX.'\',\''.$imagesizeY.'\');return false;"><img class="pn_image" src="'.$thumbimage.'" alt="'.$row['caption'].'" /></a>';


and replace with:

PHP:
				if ($imagesize[0] > $pnsettings['max_w'] || $imagesize[1] > $pnsettings['max_h']) {
$thumbimage = $pnsettings['imgpath'].'/thumb_'.$row['image'];
$display_image = '<a href="'.$pnsettings['imgpath'].'/'.$row['image'].'" target="'.$target.'"
onclick="PN_openBrWindow(\''
.$BASEHREF.$pnsettings['imgpath'].'/'.$row['image'].'\',\''.$target.'\',\'resizable=yes,scrollbars=no,width='.$imagesizeX.',height='.$imagesizeY.'\',\''.$imagesizeX.'\',\''.$imagesizeY.'\');return false;"><img class="pn_image" src="'.$thumbimage.'" alt="'.$row['caption'].'" /></a>';
} else {
$thumbimage = $pnsettings['imgpath'].'/'.$row['image']; // Check if thumb exists before linking - layingback 061122
$display_image = '<img class="pn_image" src="'.$thumbimage.'" alt="'.$row['caption'].'" />';
}



Now any image at or below the defined image size will not try to pop up the (same sized) image in a pop-up window. So to prevent a pop-up link just resize to dimensions set in Config or less.

Repeat for function gallery() if required. It is already correct in every other location! So must have just missed these 2. Will include this fix in next release. Thanks!



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.32 / 1.3.39 - 2.2.12 / 4.4.7 - 5.1.37 / 5.3.0 / 9.2.1

layingback
Site Admin
Site Admin
 
Inlägg: 1229
Blev medlem: Mar 18, 2006

Re: Disable Image pop up

Inlägg Skrivet: Ons Apr 21, 2010 11:10 am

Thanks for that LB,
I'll try it as soon as I get a chance and let you know how I go.

Cheers


_________________

OS: Linux /Apache: 2.2.6 /MySQL: 5.0.45/PHP: 5.2.4 /Dragonfly version: (9.2.1) / Firefox: 3.0.3



Rusty_'s server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.14/5.0.90/5.2.11/Dragonfly (9.2.3.1 CVS)

Rusty_
BetaTester
BetaTester
 
Inlägg: 30
Blev medlem: Feb 06, 2007
Från: Australia
Link  QR  Share this Utskriftsvänlig sida  facebook   myspace   twitthis  
Show more ...
Visa tidigare inlägg:   
Svara på inläggetSvara på inlägget Sida 1 av 1

Pro_News Community

Hoppa till:  



Du kan inte skapa nya inlägg i det här forumet
Du kan inte svara på inlägg i det här forumet
Du kan inte ändra dina inlägg i det här forumet
Du kan inte ta bort dina inlägg i det här forumet
Du kan inte rösta i det här forumet
Du kan inte bifoga filer i det här fourmet
Du kan inte ladda ner filer i detta forum

Alla tider är GMT






layingback Non-Human Terms of Use