Suggestion for new plugin

Creating and modifying plugins.
n2ition
Regular
Posts: 58
Joined: Sun Mar 20, 2005 8:43 pm
Location: Dallas, TX
Contact:

Suggestion for new plugin

Post by n2ition »

I don't know much about PHP and certainly not enough to write a plugin but I didn't know if there are other users who might want something like this so I am putting a request in for those folks who are ambitious enough to create it.

My current blog uses thumbnails in the posts and I manually configure each thumbnail to hotlink to the larger version of the photo in a new window when someone clicks on it. What I would like is a plugin that allows the thumbnails to link to a popup window with just the fullsize image inside. Right now if you select the magnify function in the media library on the backend it does this...but I would like a plugin that automatically does this inside a post if a thumbnail is used instead of the fullsize image.

Any takers?
The good news is the bad news is wrong! Random Kindness Project
cottonwood
Regular
Posts: 20
Joined: Mon Apr 25, 2005 6:05 pm

Re: Suggestion for new plugin

Post by cottonwood »

n2ition wrote:What I would like is a plugin that allows the thumbnails to link to a popup window with just the fullsize image inside. Right now if you select the magnify function in the media library on the backend it does this...but I would like a plugin that automatically does this inside a post if a thumbnail is used instead of the fullsize image.

Any takers?
It seems a little counter intuitive, but if you click the "I want to display it as a link to this URL" option when inserting images with the media browser, it defaults to making the 'URL' a link to the full sized image. Just don't change the URL provided. Don't even click in the box, because it erases it if you click in there.
n2ition
Regular
Posts: 58
Joined: Sun Mar 20, 2005 8:43 pm
Location: Dallas, TX
Contact:

Post by n2ition »

I know I can set up the thumbnail as a link using the option provided...I was just hoping to have an option on it that instead of opening an entire page it just opens up a popup window (like the media library does on the backend) Using the option provided currently I have to adjust each one manually so that it opens in a blank browser window so that my readers don't continueally have to hit the "back button" to return to my post.
The good news is the bad news is wrong! Random Kindness Project
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Personally I share the belief that the browser and user shall decide where and how to open a link.

I for one open every link in a new browser tab, but sometimes choose to not do so. I hate it when webpages dictate me where to open a link.

That is also the reason why "target" got deprecated for XHTML strict versions by the W3C and why I sadly cannot help you with this request. I can't cross my shadow in this matter :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
n2ition
Regular
Posts: 58
Joined: Sun Mar 20, 2005 8:43 pm
Location: Dallas, TX
Contact:

Post by n2ition »

Fair Enough. :wink:
The good news is the bad news is wrong! Random Kindness Project
cottonwood
Regular
Posts: 20
Joined: Mon Apr 25, 2005 6:05 pm

Post by cottonwood »

n2ition wrote:Fair Enough. :wink:
But, then again, if you wanted to edit

/serendipity/serendipity_editor.js

around line 204 and change:

Code: Select all

insert = "<a href='" + f['serendipity[url]'].value + "'>" + img + "</a>";
to

Code: Select all

fullimgWidth  = f['imgWidth'].value;
fullimgHeight  = f['imgHeight'].value;
insert = "<a href='" + f['serendipity[url]'].value + "' onclick="F1 = window.open('" + f['serendipity[url]'].value + "','Zoom','height=" + fullimgHeight + ",width=" + fullimgWidth + ",top=0,left=0,toolbar=no,menubar=no,location=no,resize=1,resizable=1,statusbar=0'); return false;">" + img + "</a>";
you just might get something like what you are looking for. Note that this will only affect new images that you insert into your entries, not images that have already been placed.

A more nuanced version of this would make the "popup link" option a third radio option under the Image Insertion: section (ie display as an image, display as a link, display as a popup link). Also this change would probably not work well if you were actually linking to another site, and not to the larger image, since the popup window is sized to the dimensions of the larger image.
n2ition
Regular
Posts: 58
Joined: Sun Mar 20, 2005 8:43 pm
Location: Dallas, TX
Contact:

Compromise

Post by n2ition »

Okay, so here's a thought that would be a compromise between having a "popup" window and being forced to use a back button when trying to view linked photos.

Is there a way to display the large image inside the blog itself? For example, when you are in the backend and entering a post and you select preview it shows what your posting will look like but it appears as if it is in a wrapper of sorts that allows the entire preview to fit inside the backend without requiring you to hit the back button to return and edit the post. Is it possible to do something like this so that just the post is replaced with a large image and underneath the image is a link to "return to post" all while inside the blog itself?

Hey guys, I don't know if this is something that can be done...or even how much work it would take. I do try very hard to use current code and not use depricated tags. But I am also using this website to communicate with a large group of people who are not computer savy. I believe in presenting to the "lowest common denominator" and that means having the blog itself stay open when the pictures are opened.

Let me know what you think. I'm great with ideas but lousy with code writing. :)

PS. Cottonwood, thanks for the code you posted. If my suggestion can't be done, I will probably go ahead and give your snippet a try.
The good news is the bad news is wrong! Random Kindness Project
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Compromise

Post by garvinhicking »

n2ition: Sure, you can place the large image in your entry! Just select the option "I want to use the larger image in my entry" and then it will put the full picture there.

BTW: Teaching your users to use the flexibility of their browser is also a great compromise ;-)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
n2ition
Regular
Posts: 58
Joined: Sun Mar 20, 2005 8:43 pm
Location: Dallas, TX
Contact:

Post by n2ition »

Oops, maybe I didn't explain that correctly. I still want the thumbnails in the post and only show the large image if they are clicked on. (I'm not quite that idiotic that I didn't know a full size image could be put in a post :P )

The idea would be that the image would pull up in the same window but in the larger form for viewing but would then have a link below it that says "return to post" and would take you back to the place you were when you clicked on the thumbnail.

For example, if I am reading a post and get to a thumbnail in the post:

Image

I then click on the thumbnail and the larger images appears in the same window therefore eliminating the need for a popup window as you haven't been lead away to a blank screen with nothing but image on it and you have an obvious link to return right back to the area of the post you were reading:

Image

It would also give a area where you could caption the large image without the need to caption the thumbnail in the post itself.

I was thinking that somehow this might be possible but you guys are the brains so I have no idea how much work something like this would take.

By the way...these photos are just doctored images and are not actual "screen shots" (at least not the second one anyway.)

What do you think?
The good news is the bad news is wrong! Random Kindness Project
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

n2ition: Sorry for misunderstand you :)

Your idea's a nice one, but harder to implement. The functions that generate the output for image alignment and embedding are currently static inside Serendipity and cannot be altered easily by plugins.

Thus it would actually be a hard bit of work. I'll add it to my todolist, but don't hold your breath :)

And it will certainly require Serendipty 0.9. Would you be willing to upgrade to 0.9-beta snapshots once I create the plugin? Or at least check out the plugin on a temporary 0.9 installation of yours and give me feedback? :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

n2ition:

Well, okay. You could've held your breath actually ;)

Please try this plugin: http://nopaste.php-q.net/130748

Put it into your plugin directory. After that, please fetch the updated serendipity_admin_image_selector.php from our SVN repository: Updated file.

This one got the plugin hooks so that my plugin can actually do its magic.

Once installed you can go to the image selection screen and will see a new "target" select dropdown. It also supports the self-adjusting JavaScript option.

And it really makes me feel bad to have betrayed my shadow like that. But it'll allow for future addition of other features; your wish for the extra page with the image only was a bit overkill for me, as I got deeper into it. I think it doesn't pay off that well. :)

Hope you'll have fun with the plugin and it works.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
n2ition
Regular
Posts: 58
Joined: Sun Mar 20, 2005 8:43 pm
Location: Dallas, TX
Contact:

Post by n2ition »

Sorry if this is a stupid questions but do I need to create a folder for that plugin?

Also, the plugin ID at the top of the code indicates it is a nl2br plugin but shouldn't it be called imageselectorplus?

I just don't want to screw up something...and I am VERY GOOD at screwing things up. :)


By the way, if you do get brave and do decide to try to do the feature I suggested, I'd be more than happy to test the beta snapshots.
The good news is the bad news is wrong! Random Kindness Project
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

n2ition: Yes, create a plugins/serendipity_event_imageselectorplus/ directory with the .php file in it. The admin_image_selector.php file from the SVN link needs to be put into the main directory.

The top of the file can be ignored; it's just the ID-String from the plugin I used as a template.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
n2ition
Regular
Posts: 58
Joined: Sun Mar 20, 2005 8:43 pm
Location: Dallas, TX
Contact:

Post by n2ition »

Garvin, for some reason, s9y isn't recognizing the new plugin. I've uploaded the new directory & file as well as updated the serendipity_admin_image_selector.php file but when I try to install the event plugin it's not showing up.

If you have some time and it's easier IM me through ICQ.
The good news is the bad news is wrong! Random Kindness Project
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

n2ition:

I just committed suport to the plugin for the option/feature you wished for, to show the large version alone in an entry. I hope you like it.

As for the plugin, you will need to edit the plugin file and at about the top of the file adjust the "serendipity" requirement from "0.9" to "0.8" - currently the plugin needs Serendipity 0.9 to function because of the changes in serendipity_admin_image_selector.php. Since you took the right file frmo 0.9, you can safely edit your plugin to only require serendipity 0.8 so that it will work.

I'm sorry for that bit of inconvenience, but I think it's fairly easy to edit :)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply