This server will be upgraded at 3pm Sydney time on December 3rd (December 2nd, 8pm PST) and will be down for up to 30 minutes.

Drag and Drop Image Attacher Plugin

Name Image Attacher Plugin
Version 1.7
Product Versions Tested with Confluence 2.5.5, 2.7.2, 2.7.3, 2.8.0, 2.9.0
Author(s) K.C. Baltz
Homepage http://kcbaltz.blogspot.com/
Price Free (Leave a comment if you like it)
License BSD
IssueTracking http://developer.atlassian.com/jira/browse/CIAP
Download JAR image-attacher-plugin-1.6.jar
Download Source Source

Description/Features

This plugin modifies the Insert Image dialog by adding a link that, when clicked, reveals a Java applet that can be used to attach images to the page. The applet accepts input via Drag 'n Drop and Paste from the clipboard. Once a picture is chosen, it can be uploaded whole or the user can draw a rectangle around the portion they wish to attach and the applet will upload only that portion as a new image (useful for screenshots!).

Note: This plugin may resolve Add the Jira screenshot applet to Confluence and Allow users to paste image in WYSIWYG editor.

Price

This plugin was originally built for the Atlassian Codegeist competition in the hopes that I would win fame and fortune. However, my plugin didn't win, so the fortune part is out (the contest requires you to give away the plugin). However, hope is not lost. You can help with the fame bit. If you use this plugin and you like it, leave a comment or send me an email. If you use it somewhere interesting, I'd especially like to know about that.

Installation

In order for this plugin to work in Rich Text mode, you must disable the wysiwygpopup component of the TinyMCE plugin. This is the plugin that enables the Rich Text editor mode. Disabling the wysiwygpopup component allows the Image Attacher plugin to insert the link to display the applet. See the following instructions.

Enable the Image Attacher Plugin in the Rich Text Editor

You should wait until the Image Attacher Plugin is installed and verified to be working in Wiki Markup mode before performing this step. This step is only required if you want the Image Attacher Plugin to work in the Rich Text editor. To do this, you must disable the WYSIWYG popup by doing the following:

  • As an administrator, go the the Administration section of Confluence, by clicking the Administration link at the top of the page.
  • Click the "Plugins" link on the left
  • Find the TinyMCE Plugin in the list of Installed Plugins and click its link
  • The TinyMCE Editor Plugin should appear with several components. Find the one labeled "wysiwygpopup" and click the link next to it marked disable. It should turn red as in the following screenshot:
Unable to render {include} Couldn't find a page to include called: DOC:Installing plugins overview

Requirements

Server

This plugin requires that the Confluence Remote API plugin be installed and enabled. Specifically, the applet uses the SOAP interface for attaching the images.

Client

Users who wish to take advantage of this plugin must have Java installed. Java 1.5 is required as of version 1.7 of this plugin. 1.4.2 was supported until version 1.6. Note, the applet is not rendered unless they click the link to show it (or choose to have it shown automatically), so they are not forced to endure any applet load times unnecessarily.

Usage

Once installed, the Insert Image dialog is modified with an additional link, "Show Image Attacher Applet". Clicking on this link causes the Insert Image dialog to grow vertically and display a Java applet. This applet is signed, so they user must explicitly allow the applet to run.


Once the applet is visible, the user may choose an image for upload by pasting from the system clipboard or by dragging and dropping the image (e.g. from a drive in Windows Explorer). The image will be displayed, scaled to fit if necessary. At this point, the user can choose to upload the entire image, or only a portion. If a portion is desired, the user simply drags a rectangle around the desired subsection.

Once the image is ready for upload, clicking the Upload button causes a login box to appear. This is the user's Confluence login. (Note: I couldn't find a way to take advantage of the fact that the user is already logged in. It would be nice if the Confluence Remote API allowed for this).

After successfully authenticating, a dialog is shown allowing the user to choose a name and comment for the file (NOTE: the Confluence Remote API is currently broken with regards to Attachment Comments ). Clicking OK then initiates the upload. When it successfully completes, the image will be inserted into your page at the location of the cursor. Note, 2.8.0 appears to have an issue where images are always inserted at the end of the page. This behavior has been observed with and without this plugin.

Note, if you want to align the image or mark it as a thumbnail, make those selections in the Insert Image dialog prior to uploading your image.

Showing/Hiding the Applet by Default

The Insert Image dialog includes a link that allows you to toggle between showing or hiding the applet by default. This setting currently depends on a browser cookie. I'd like to make this part of the user profile, like the "Make Rich Text Editor the Default", but I haven't figured out how yet.

Version History

Version Date State License Price
Show description 1.0 (#1) 29 Apr 2008 Prerelease Freeware / Open Source (BSD) Free

Release Notes

Initial Release

Contributors

  • K.C. Baltz — Developer

Show description 1.1 (#2) 29 Apr 2008 Prerelease Freeware / Open Source (BSD) Free

Release Notes

  • Fixed the progress dialog to display correctly during the upload.
  • Fixed the plugin manifest key so it matches the Plugin Repository.

Contributors

  • K.C. Baltz — Developer

Show description 1.2 (#3) 30 Apr 2008 Prerelease Freeware / Open Source (BSD) Free

Release Notes

  • This plugin now works with the Rich Text/WYSIWYG editor! Yay! However, you do have to disable the wysiwygpopup component of the TinyMCE plugin in order for this to work. See the plugin homepage for instructions

Contributors

  • K.C. Baltz — Developer

Show description 1.3 (#4) 06 May 2008 Prerelease Freeware / Open Source (BSD) Free

Release Notes

  • There is now a link to let the user request that the applet be shown/hidden by default.

Contributors

  • K.C. Baltz — Developer

Show description 1.4 (#5) 07 May 2008 Prerelease Freeware / Open Source (BSD) Free

Release Notes

  • Backported the applet to run in JRE 1.4.2 (and possibly earlier).

Contributors

  • K.C. Baltz — Developer

Show description 1.5 (#6) 15 May 2008 Prerelease Freeware / Open Source (BSD) Free

Release Notes

  • Backported to Confluence 2.5.x (2.5.5 tested). Currently only Wiki-markup mode works
  • Added a fix to attempt to solve issues some users are reporting loading the applet.

Contributors

  • K.C. Baltz — Developer

Show description 1.6 (#7) 18 May 2008 Stable Freeware / Open Source (BSD) Free

Release Notes

  • Added support for Rich Text (WYSIWYG) editor in Confluence 2.5.5

Contributors

  • K.C. Baltz — Developer

Show description 1.7 (#8) 14 Jul 2008 Stable Freeware / Open Source (BSD) Free

Release Notes

  • Improved the GUI adding the ability to choose the image type for the uploaded image (PNG or JPG)
  • Adding error handling to detect and warn before overwriting an existing attachment
  • The filename of a dragged-n-dropped file is now used for the uploaded attachment.
  • The applet should now be willing to connect to web servers with self-signed HTTPS certificates.

Contributors

  • K.C. Baltz — Developer

Open Issues

Future Plans (post-contest)

I'm working on having the plugin be smarter about naming attachments. It will suggest a name that isn't a conflict with an existing one.

November 1, 2008 - I'm working on a way to optionally preserve your username and password between sessions, eliminating the need to repeatedly login. This will be in the next release that should be soon.

Finally, it might be nice to add some annotation capabilities since I see one of the primary use cases being screenshots. Until then, Mac users can use [Skitch]. Once they have a Windows version I can play with, I'll see if that's sufficient or if it's worth opening the Pandora's box of potential bugs that this feature would bring to the applet. This should also work well with SnagIt.

Dependencies

This plugin relies on the Confluence SOAP API and thus makes use of a number of libraries including Axis2 and all it requires. Maven is able to download all of the dependencies with the exception of the Confluence Maven2 SOAP library. You'll have to download and install (mvn install) this yourself. Note that this library is set up by default to compile 1.5 classfiles. If you'd like to support earlier JRE's, you should modify the pom.xml and replace the 1.5/1.5 source/target value of the compiler plugin with 1.3/1.1.

Building the Plugin

Here are some quick and dirty build instructions.

  • Download, build and install (mvn install) the Confluence Maven2 SOAP library.
  • Download and install the Beans Binding framework jar in your Maven repository
    • Find version 1.2.1 here: Beans Binding
    • From the directory where you download the jar, install it using the following command (See this page for more information on what's going on):
      mvn install:install-file -Dfile=beansbinding-1.2.1.jar \
                               -DgroupId=org.jdesktop.beansbinding \
                               -DartifactId=beansbinding \
                               -Dversion=1.2.1 \
                               -Dpackaging=jar \
                               -Dclassifier=sources \
                               -DgeneratePom=true 
      
  • Obtain the source for this plugin (see above) and make sure you have both modules, image-attacher-applet and image-attacher-plugin.
  • In the image-attacher-applet directory, run mvn clean install to install a ZIP file with the signed applet and its signed jars
  • In the image-attacher-plugin directory, run mvn clean package to build a jar with the plugin files and the applet jars.

The plugin is in the file image-attacher-plugin/target/image-attacher-plugin-1.0-SNAPSHOT-jar-with-applet.jar. Install this in Confluence according to the instructions above.

Labels

codegeist_2008_confluence codegeist_2008_confluence Delete
plugins plugins Delete
entries entries Delete
plugin plugin Delete
image image Delete
attach attach Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Apr 28, 2008

    Per Fragemann says:

    If this works (and works with 2.8) you have my vote. Oh, I am not part of the of...

    If this works (and works with 2.8) you have my vote. Oh, I am not part of the official judgement team? Crap.

    Still, I am very excited to see if this plugin can deliver what it promises to!

    Cheers,
    Per

    1. Apr 28, 2008

      KC Baltz says:

      Thanks! I'll be uploading the source and binaries soon and you can let me know ...

      Thanks! I'll be uploading the source and binaries soon and you can let me know how it works for you.

  2. Apr 29, 2008

    Tibor Hegyi says:

    Hi, thanks for publishing this - I have also started to implement this feature...

    Hi,

    thanks for publishing this - I have also started to implement this feature for the codegeist , but have not yet opened an entry and I followed a bit different approach though.

    You are much further than me, so I hang up the development.

    If you need a second hand, let me know - I may have a bit of free time now

    Tibor

    1. Apr 30, 2008

      KC Baltz says:

      Thanks for the offer. At this point, I'm hesitant about the potential for confu...

      Thanks for the offer. At this point, I'm hesitant about the potential for confusion that might be caused by adding another developer to the mix with less than two weeks to go (and JavaOne as a distraction in the last week).

      However, I'd love it if you'd try out the plugin and give me your feedback.

  3. Apr 30, 2008

    Petr Kohutek says:

    Good job, it is much more convenient than before, thanks. I have observed a mi...

    Good job,

    it is much more convenient than before, thanks.

    I have observed a minor problem, Confluence after installing the plugin generated an error message, that it expected a name (something resembling web address) and instead found a name Image Attacher. When I pressed OK, it started to work.

    Some of my colleagues are looking forward to the Rich Text compliance

    Petr

    1. Apr 30, 2008

      KC Baltz says:

      I noticed the key mismatch as well and I thought I had fixed it last night (~11p...

      I noticed the key mismatch as well and I thought I had fixed it last night (~11pm GMT-8). When did you install the plugin? Perhaps the old jar was still cached somewhere at Atlassian or in your version of Confluence?

      Regarding the Rich Text, believe me, that's number one on my list. The problem is that the Rich Text editor itself is a plugin (TinyMCE) and the story for plugins overriding other plugins is not well defined. I'm starting to consider offering a patch, but I'm not sure how resilient to upgrades that will be.

      Finally, I added a small change last night to eliminate the need to pick the image you just uploaded. Now, it immediately inserts the picture in your page after the applet finishes uploading the image. Tonight I'll change the documentation above to reflect this.

      1. May 01, 2008

        KC Baltz says:

        Update: I got the Rich Text editor functionality working tonight. Be sure to g...

        Update: I got the Rich Text editor functionality working tonight. Be sure to get version 1.2 and read the special installation instructions I've added to this page.

  4. May 01, 2008

    huasoon says:

    This is a feature I have been dreaming for - the support for object linking and ...

    This is a feature I have been dreaming for - the support for object linking and embedding.

    This is one of the key features in microsoft office applications that would definitely win more believers to working with wikis.

    Thanks

    1. May 13, 2008

      huasoon says:

      Another idea came upon me, but it is very difficult. It will be good if I can c...

      Another idea came upon me, but it is very difficult.

      It will be good if I can copy and paste and entire web page (by select all + copy + paste) to paste in the plugin.

      Then the applet will generate the images and upload as attachments and also render the text as wiki markup.

      It will save the users the hassle to copy and paste several times. 

      1. May 13, 2008

        KC Baltz says:

        You're right, that is difficult. What's your use case? Why are people copyin...

        You're right, that is difficult.

        What's your use case? Why are people copying and pasting web pages instead of just linking to them? I'm not saying it doesn't make sense, but I'd like to understand the reason to better understand the potential feature.

  5. May 16, 2008

    KC Baltz says:

    The contest is over, but work continues on this plugin. Atlassian tells me I ca...

    The contest is over, but work continues on this plugin. Atlassian tells me I can continue to develop as long as I note the version of my code that was submitted at the end of the contest. I'm not sure how to apply a tag in Subversion, but I know my last checkin was revision 18885, version 1.4 of my plugin. This page is locked from editing, so I can't modify the links above, but hopefully this comment will satisfy the judges.

    As promised, I have attempted a backport to earlier versions of Confluence. I checked in a new version of the plugin, 1.5, with support for the Wiki Markup editor. I may be able to get Rich Text working as well, but once again it is difficult. Additionally, the Insert Image dialog changed between 2.5.5 and 2.7.2. That is preventing me from automatically inserting the image into the page after a successful upload. Instead, the Insert Image dialog will refresh, showing your image and you'll have to click on it to complete the insert.

    1. Jun 04

      KC Baltz says:

      I forgot mention that a few weeks ago I got the Rich Text Editor working in Conf...

      I forgot mention that a few weeks ago I got the Rich Text Editor working in Confluence 2.5.5. Please install version 1.6 of the plugin from the plugin repository to take advantage of this feature. Alternately, you can download it directly from:

      http://svn.atlassian.com/svn/public/contrib/confluence/image-attacher/image-attacher-plugin/jars/image-attacher-plugin-1.6.jar

      I'm starting to get terrific feedback on this plugin and I'll try to get to the feature requests soon. Please keep the feedback coming.

  6. May 30, 2008

    Tomas R says:

    Great plugin! It would be nice if you wouldn´t have to manually give the im...

    Great plugin!

    It would be nice if you wouldn´t have to manually give the image a unique name every time you insert more than one into the same page. When I just pasted the second image without changing the standard name (defaultFilename.jpg), the first one was overwritten. If you could make the plugin add something at the end of the filename, like defaultFilename2.jpg the second time you paste a picture, it would be even more convenient to use! 

  7. Jul 15

    Stefan Baader says:

    I tried it out, but got an system error after running the upload:

    I tried it out, but got an system error after running the upload:

    1. Jul 15

      KC Baltz says:

      If you're familiar with how to bring up the Java Console for the applet, it prob...

      If you're familiar with how to bring up the Java Console for the applet, it probably has more detail on the failure. Can you please check what it says and I'll try to figure out what's going on?

      Troubleshooting questions that come to mind:

      • Do you have Confluence Web Services turned on?
      • Is your site on HTTPS? If so, is the cert valid or do you get warnings because it's self-signed or expired?
    2. Nov 11

      HelenS says:

      Great plugin! I've got it working if I upload an image on the same machine t...

      Great plugin! I've got it working if I upload an image on the same machine that's hosting Confluence. However when I try to do it from another machine (same login) I get the above error. Any ideas?

      1. Nov 11

        KC Baltz says:

        With a default install of Confluence, it is setup to use "localhost" as the host...

        With a default install of Confluence, it is setup to use "localhost" as the hostname for Confluence. If you don't change this, several things will not work when you access Confluence from another machine. Is this possibly the issue?

        Configuring the Server Base URL

        1. Nov 12

          HelenS says:

          Thanks for your reply. Yes it's using localhost for the trial - I didn't realise...

          Thanks for your reply. Yes it's using localhost for the trial - I didn't realise that would cause problems. Hopefully it will be resolved when we upgrade to the full version of Confluence then. Cheers.

  8. Jul 17

    Igor Myagchev says:

    I have the same trouble with "System error encountered while authenticating". T...

    I have the same trouble with "System error encountered while authenticating".

    The Java Console exception:

    Java Plug-in 1.5.0_15
    Using JRE version 1.5.0_15 Java HotSpot(TM) Client VM

    17-Jul-2008 10:02:49 org.apache.axis.utils.JavaUtils isAttachmentSupported
    WARNING: Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
    AxisFault
     faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
     faultSubcode:
     faultString: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.String
     faultActor:
     faultNode:
     faultDetail:
    	{}faultData:null
    	{http://xml.apache.org/axis/}hostname:xana
    
    java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.String
    	at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
    	at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
    	at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
    	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
    	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
    	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    	at javax.xml.parsers.SAXParser.parse(Unknown Source)
    	at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
    	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
    	at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
    	at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
    	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
    	at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
    	at org.apache.axis.client.Call.invoke(Call.java:2767)
    	at org.apache.axis.client.Call.invoke(Call.java:2443)
    	at org.apache.axis.client.Call.invoke(Call.java:2366)
    	at org.apache.axis.client.Call.invoke(Call.java:1812)
    	at com.dolby.atlassian.confluence.soap.model.confluence.ConfluenceserviceV1SoapBindingStub.login(ConfluenceserviceV1SoapBindingStub.java:3743)
    	at com.kcbaltz.confluence.imageAttacher.ConfluenceConnection.login(ConfluenceConnection.java:132)
    	at com.kcbaltz.confluence.imageAttacher.UploadWorker.run(UploadWorker.java:62)
    	at java.lang.Thread.run(Unknown Source)
    

    The version of Confluence: 2.7

    Feature Settings
    Some features are installed as plugins, and must be enabled or disabled from the plugin administration page.

    Rich Text Editing: ON
    Users see Rich Text Editor by default: ON
    CamelCase Links: OFF
    Threaded Comments: ON
    TrackBack: OFF
    Remote API (XML-RPC & SOAP): ON
    Compress HTTP Responses: OFF
    Draft Save Interval: 30 seconds
    Number of Ancestors to Show in Breadcrumbs: 1

    Security and Privacy
    Settings for user management, site security and user privacy.

    External user management: OFF
    Public Signup: ON
    Hide External Links From Search Engines: ON
    User email visibility: public
    Anonymous Access to Remote API: OFF