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.
  
18 Mar '10 Thu Mar 18, 2010 14:24    
Rusty_
BetaTester  BetaTester
  •  

Post Disable Image pop up

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)

 
 
 
 
  
21 Apr '10 Wed Apr 21, 2010 04:27    
layingback
Site Admin  
  •  

Post Re: Disable Image pop up

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 Wink )

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 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 
 
 
 
  
21 Apr '10 Wed Apr 21, 2010 16:49    
layingback
Site Admin  
  •  

Post Re: Disable Image pop up

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 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 
 
 
 
  
21 Apr '10 Wed Apr 21, 2010 18:10    
Rusty_
BetaTester  BetaTester
  •  

Post Re: Disable Image pop up

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)

 
 
 
 
  
1 Nov '14 Sat Nov 01, 2014 15:09    
nawaz
Newbie  Newbie
  •  

Post Re: Disable Image pop up

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




______________
Nawaz



nawaz please enter your server specs in your user profile! Crying or Very sad  
 
 
 
  
2 Nov '14 Sun Nov 02, 2014 00:51    
layingback
Site Admin  
  •  

Post Re: Disable Image pop up

Just copy the template that you are using to a new name (eg change index to your username), and then switch to that custom template.

To turn off popup just find the image IMG command and remove the a href and /a HTML. Repeat for home, headlines and the article as required.



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

2.6.32 / 1.3 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 
 
 
 
Link  QR 
Share this Printer Friendly Page  facebook   google+   linkedin   twitthis  
Show more ...



Forum Permissions - You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum