Open Images in a WordPress page plugin
-
Ajay has written a plugin that makes all images open in a new window, it’s a very nice plugin, and I want to modify the code so that the image opens in a dedicated WordPress window. Perhaps someone can check the code below and tell me where should I add the URL for the landing page, and what code should there be in the “landing” (page if any) to receive this image.
========================================================
/* Open Picture Window */
function ald_OpenPictureWindow(theURL, winName, features, myWidth, myHeight, isCenter, myTitle)
{
var ald_opw = null;
var settings;
settings = ‘width=’+myWidth+’,height=’+myHeight;if(!myTitle) myTitle = “Brought to you by Open Picture Window Plugin”;
if(isCenter) // Position in center of window
{
var myLeft = (screen.width) ? (screen.width-myWidth)/2 : 0;
var myTop = (screen.height) ? (screen.height-myHeight)/2 : 0;settings +=’,left=’+myLeft+’,top=’+myTop;
}if(features!=”) settings +=’,’+features; // add features passed as argument
ald_opw = window.open(”,winName,settings);
with (ald_opw.document)
{
open(‘text/html’, ‘replace’);
write(‘<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>\n’);
write(‘<html xmlns=”https://www.w3.org/1999/xhtml”>\n’);
write(‘<head><title>’);
write(myTitle);
write(‘</title></head>\n’);
write(‘<body style=”border:0;margin:0″>\n’);
write(‘<img src=”‘+ theURL +'” ‘);
write(‘title=”‘+ myTitle +'” alt=”‘+ myTitle +'” ‘);
write(‘/>\n’);
write(‘</body></html>\n’);
close();
}}
=======================================================Here’s the link for Ajay’s plugin:
https://ajaydsouza.com/wordpress/plugins/open-picture-window-plugin/#downloadsHere’s a WordPress blog that does what I want to do, that is it opens all images in a special WordPress page that has the header, a “back to the blog” link, and a few ads.
In case it’s easier for someone, here’s another plugin by Zappelfillip that does something similar, in this case the images will show up in a popup window.
https://www.zappelfillip.de/index.php/2005-10-25/zap_imgpop/
I am actually surprised that nobody implemented this for WP yet, seems to me a part of an integrated blog experience to have images open within the blog environment rather than “on their own” in a blank browser page with no WP header or footer, “back to blog” thing, etc. This feature has been standard with Movable Type for ever. My point is, if you help out figure what to modify, I am sure a lot of people will begin using this “open image in WP page” plugin as it rounds up the image experience for the blog. The image will not be treated as an “orphan” anymore, it will be owned by the blog which will display it along with a header, footer, etc.
Thanks for any help or suggestions
PS: Yes, I did ask Ajay and Zappelfillip for help with modifying the plugin so that it opens in a dedicated WordPress page; Ajay say maybe later and Zappelfillip said no.
- The topic ‘Open Images in a WordPress page plugin’ is closed to new replies.