Extension talk:AnyWikiDraw

From mediawiki.org
Jump to navigation Jump to search

Alignment of Images[edit]

Awesome tool - I really like it.

Please consider the following wishes/ideas for future enhancements:

  • Add alignment option (right left center) as typical Image:Link would do.
    My workaround is to frame the #drawing-tag with div-container and float-style.
  • Add display option as thumbnail.
  • Add option or guide to edit picture on Image:page
    With this, the wiki pages would not be disturbed by the frame and "edit"-link (using Image:link instead) but editing is still possible on the Image:page.

--Jorgo 13:29, 23 July 2009 (UTC)

Hi Jorgo. These are excellent suggestions. I will consider them for future updates of AnyWikiDraw.
--Rawcoder 07:49, 1 August 2009 (UTC)

Image Embedding with original aspect ratio[edit]

Greetings: Additional ideas for further releases from Jorgo ...

When embedding clipart as bitmaps, I'd like to

  • embed in original pixel size
  • preserve the aspect ratio from original bitmap
  • zoom with preserved aspect ratio

This would be an excellent solution for commenting bitmaps in SVG files with graphical objects.

--Jorgo 12:45, 11 September 2009 (UTC)

For AnyWikiDraw 0.14 I have added the following actions to the popup menu: "Set to image size", "Adjust height to image aspect", "Adjust width to image aspect". These actions are shown, when the popup menu is opened over a bitmap image which does not have its original size. I hope this does the trick. I will add support for scaling with preserved aspect ratio in a future release.
--Rawcoder 12:49, 21 October 2009 (UTC)

Unable to save images[edit]

After I edit images the changes are not saved, and new images are not created.

I'm using a fresh apt-get installed mediawiki in ubuntu — that is, mediawiki 1.13.3. I enabled image upload and imagemagick. I can successfully upload images. I have tried creating new svg's and jpg's, and editing existing jpg's; none can save changes. What step have I missed?

What error message do you get from the applet?
--Rawcoder 19:44, 5 August 2009 (UTC)
I don't get one as far as I can tell. Where should I be looking? 20:09, 8 August 2009 (UTC)
Well. The applet should display a red error symbol and a message if it can not save the drawing.
What exactly happens when you click the save button? Does the applet display a message that saving is in progress? What happens next?
--Rawcoder 08:16, 9 August 2009 (UTC)

I am also unable to save images. We are using mediawiki 1.15. I did install ImageMagick. When I try to save an SVG image, it says

Couldn't save the drawing:
Upload address: /wiki/index.php/Special:AnyWikiDraw
Error message: 403 Forbidden <html><body><p>You are not allowed to change this

Try Google Chrome seems like the java in it works. Also try IE. I had the same issue you have with Mozilla.

Alangley 18:57, 23 October 2009 (UTC)

In order to save a drawing, you need to be logged into your Wiki. Anonymous users usually don't have enough permissions to upload a file to the Wiki.
AnyWikiDraw shouldn't display the edit link, when a user is not logged in though. I will look into this for a future release of AnyWikiDraw.
--Rawcoder 06:15, 27 October 2009 (UTC)

403 Forbidden error, cause: undefined index "DrawingData"[edit]

I'm running Mediawiki 1.15.1. I've setup Batik to handle SVG since I'm running on Windows. I can create a drawing, edit it, but when I save it, I get a 403 Forbidden error, much like what Alangley sees. However, mine is throwing an error complaining about the "DrawingData" not being a defined index, which shows up in the error message returned.

In the code, it is referencing the array index 'DrawingData', but is not able to find it. This would be file "AnyWikiDraw.body.php".

function processUpload() {
  global $wgRequest, $wgOut;
  // Fill in the form data as needed by the upload form
  $wgRequest->data['wpDestFile'] = $wgRequest->data['DrawingName'];
  $wgRequest->data['wpIgnoreWarning'] = '1';
  $wgRequest->data['wpDestFileWarningAck'] ='1';
  $wgRequest->data['wpUploadDescription'] = $wgRequest->data['UploadSummary'];
  $wgRequest->data['wpUploadFile'] = $wgRequest->data['DrawingData'];          <--- HERE ---
  $_FILES['wpUploadFile'] = $_FILES['DrawingData'];
  $wgRequest->data['action'] = $wgRequest->data['Action'];

So what reason would there be that the "DrawingData" index isn't being defined on the data array in the request? Could there be a problem with the Batik image converter setup? I'm able to upload images to my wiki, and I'm logged in as a user, so there's no security issue with image uploads. Let me know, thanks.

Hex2bit 15:05, 6 November 2009 (UTC)

Maybe the applet fails to encode the drawing data as an SVG file. I doubt that the Batik image converter has anything to do with it, because it comes only into play, after a drawing has been uploaded. Can you take a look at the Java console in your browser? Maybe there is an error message there which helps me fix this problem.
--Rawcoder 12:19, 11 November 2009 (UTC)
I just tried it again and now it's working... weird. I didn't change a thing. Maybe some security element needed a PC restart, I don't know. I had restarted IIS during testing, but that never fixed it. If I see the error again in the future, I'll definitely check the Java console.
Hex2bit 22:53, 16 November 2009 (UTC)
Okay. Its good that it works now. Did you run the web-server and the browser on the same computer? In this case, it is not clear to me, where the problem was (on the server-side or on the client-side).
--Rawcoder 20:07, 17 November 2009 (UTC)

Breaks Special:SpecialPages[edit]

Seems odd to me, but when I had this extension active over many, many versions from SVN, I've been getting this error: "Fatal error: Cannot redeclare class SpecialUpload in /opt/local/apache2/htdocs/w/includes/specials/SpecialUpload.php on line 635") Niels Olson 01:30, 16 December 2009 (UTC)

Hi Nils. I am only testing AnyWikiDraw with releases of MediaWiki.
--Rawcoder 16:01, 16 January 2010 (UTC)

Broken in 1.16[edit]

An update to mediawiki trunk would be greatly appreciated --Alterego 04:40, 18 February 2010 (UTC)

Hi Alterego.
MediaWiki 1.16 is not released yet. I won't do fixes based on unstable code in the trunk.
--Rawcoder 22:20, 24 February 2010 (UTC)
Mediawiki trunk is not unstable. That is the code that is being run on Wikipedia, and that I run on my wikifarm, and that many other people run. We do not experience stability issues. ---Alterego 16:28, 29 May 2010 (UTC)
Ah, sorry. I meant unstable in a structural sense, meaning that API's can be changed at any time. --Rawcoder 15:16, 8 June 2010 (UTC)

Java Error.[edit]

When I click the edit button above an image, the Java app box says: Error. Click for details. This is in Firefox 3.6 for Windows. The output of the error is: Java Plug-in 1.6.0_17 Using JRE version 1.6.0_17-b04 Java HotSpot(TM) Client VM User home directory = C:\Users\spencer8ab

c: clear console window f: finalize objects on finalization queue g: garbage collect h: display this help message l: dump classloader list m: print memory usage o: trigger logging q: hide console r: reload policy configuration s: dump system and deployment properties t: dump thread list v: dump thread stack x: clear classloader cache 0-5: set trace level to <n>

load: class org.anywikidraw.mediawiki.MediaWikiDrawingApplet.class not found. java.lang.ClassNotFoundException: org.anywikidraw.mediawiki.MediaWikiDrawingApplet.class at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source) at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Exception: java.lang.ClassNotFoundException: org.anywikidraw.mediawiki.MediaWikiDrawingApplet.class

I've also tested under Arch Linux and Opensuse, both also in firefox, I get the same result in both. I don't need java on the server, do I? The server currently just has gcj, I do have root access though, so I could install Java if I need too, I followed all of the installation steps, including setting up imagemagick. -- Spencer8ab 19:00, 18 March 2010 (UTC)

This is on mediawiki 1.15 by the way. -- Spencer8ab 19:04, 18 March 2010 (UTC)
It also doesn't show up on the Special:Version page, despite the drawing tag working, and a java app showing up. -- Spencer8ab 19:16, 18 March 2010 (UTC)
The error message indicates that either the file AnyWikiDrawForMediaWiki.jar is missing on your server, or the URL in the "archive" attribute of the applet tag is pointing to the wrong location. If you inspect the HTML code of the page after clicking at "Edit", you should see an applet tag with a "codebase" and an "archive" attribute, like this:
<applet codebase="/" archive="/mediawiki-1.15.0/extensions/AnyWikiDraw/AnyWikiDrawForMediaWiki.jar" ...
(Instead of "/mediawiki-1.15.0" there can be something else).
On my installation, the hook for "drawing" is listed under "Parser function hooks" of Special:Version page. AnyWikiDraw has a special page of its own. Try opening the page Special:AnyWikiDraw.
--Rawcoder 18:36, 26 May 2010 (UTC)

Created image links to failed page[edit]

Not sure where to report bugs / fixes - I found that after creating the page the image displayed fine but then clicking on the image caused problems. Fixed AnyWikiDraw.php by replacing links to




not sure if this is the right way to do this as I'm not a MW expert but it seems to work. Thanks for a good extension! --Rob C 13:08, 1 April 2010 (UTC)

Hi Rob. I have implemented a fix for this in AnyWikiDraw 0.17.
--Rawcoder 14:41, 29 May 2010 (UTC)

Fatal error: Call to a member function getDescriptionUrl() on a non-object in extensions/AnyWikiDraw/AnyWikiDraw.php on line 188[edit]

MediaWiki 1.15.4
PHP 5.3.2 (apache2handler)
PostgreSQL 8.2.17
AnyWikiDraw 0.13.2

When pressing Edit link near the image, I see the following error message:

Fatal error: Call to a member function getDescriptionUrl() on a non-object in extensions/AnyWikiDraw/AnyWikiDraw.php on line 188

Line 188:

 183         $output .= '<div style="'.
 184                                 'background-color: #C9CDD6; border: 1px solid #ccc; padding: 5px 10px 5px 10px; text-align: left; '.
 185                                 'font-size: 12px; line-height: 16px; '.
 186                                 '">'.
 187                                 wfMsg(($image === false) ? 'anywikidraw_license_terms_new_work' : 'anywikidraw_license_terms_derived_work',
 188                                 '<a href='.wfMsgForContent('copyrightpage').'>'.wfMsg('copyrightpage').'</a>', '<a href="'.$image->getDescriptionUrl().'">Image:'.$name.'</a>').
 189                                 '</div>';
 190 } else {
 191         // Retrieve the page object of the image to determine, whether the user may edit it
 192         $filtered = preg_replace ( "/[^".Title::legalChars()."]|:/", '-', $name );
 193         $nt = Title::newFromText( $filtered );
 194         if(! is_null( $nt ) ) {
 195                 $nt =& Title::makeTitle( NS_IMAGE, $nt->getDBkey() );
 196         }

What can I do to fix it? Serhii Laskavyi 17:39, 10 June 2010 (UTC)

Can you please try whether this problem also occurs in AnyWikiDraw 0.17?
Best, --Rawcoder 08:50, 11 June 2010 (UTC)
I'm running AnyWikiDraw 0.17 and I'm getting an
Fatal error: Call to a member function getDescriptionUrl() on a non-object in extensions/AnyWikiDraw/AnyWikiDraw.php on line 188
error message Serhii Laskavyi 16:19, 18 June 2010 (UTC)
Here is a fix. Replace the lines 183 through 189 by the code below.
--Rawcoder 08:08, 28 June 2010 (UTC)
 183           $output .= '<div style="'.
 ...           'background-color: #C9CDD6; border: 1px solid #ccc; padding: 5px 10px 5px 10px; text-align: left; '.
 ...           'font-size: 12px; line-height: 16px; '.
 ...           '">';
 ...           if ($image !== false) {
 ...              $output .= wfMsg('anywikidraw_license_terms_derived_work',
 ...                   '<a href='.wfMsgForContent('copyrightpage').'>'.
 ...                   wfMsg('copyrightpage').'</a>', '<a href="'.
 ...                   $image->getDescriptionUrl().'">Image:'.
 ...                   $name.'</a>');
 ...           } else {
 ...               $output .= wfMsg('anywikidraw_license_terms_new_work');
 ...           }
 189           $output .= '</div>';

drawing creation error[edit]

When I try to put in any AnyWikiDraw document I get "Fatal error: Call to undefined method Title::userCanEdit() in C:\xampp\htdocs\wiki\extensions\AnyWikiDraw\AnyWikiDraw.php on line 201"

I'm using MediaWiki 1.17alpha and AnyWikiDraw 0.17, cheers.

This happens through a API change in rev 50951 (2009-05-24) of MediaWiki: userCanEdit() was marked since a longer time as deprecated, then removed
--Schwier 23:12, 12 Octobre 2010 (MEZ)

Use this fix (line numbers due to use of Subversion trunk version):

206		$userCanEdit = $wgEnableUploads &&
207                    !$isProtected &&
208                    (is_null($nt) || $nt->userCan('edit')) &&
209                    (is_null($image) || $wgUser->isAllowed( 'reupload' ));

Important change is: $nt->userCanEdit() changed to $nt->userCan('edit')

Thank you. I have committed this change into the repository. --Rawcoder 08:05, 16 October 2010 (UTC)

please start at the beginning - can't get MW to recognize AWD tag[edit]

First off- this looks like a great tool. Thanks for developing and sharing.

I'm running mediawiki 1.15.4 on a local drive (IIS) with php 5.3.2 and mysql; testing in Firefox 3.5.10.

I downloaded the AnyWikiDraw 0.17 zip file, extracted contents, copied the appropriate AnyWikiDraw folder to my extensions directory. I edited my LocalSettings to allow uploads and jpg file extension and enabled AnyWikiDraw.

I edited a page by inserting the tag as follows "{{#drawing:someimage.jpg|300|200}}". When I click save, I get nothing. It just displays the tag as plain text. The demo works if I click it directly. What am I missing? Thanks- Phil

UPDATE: I installed the StringFunctions and ParserFunctions extensions. It seems to work now.

Hi Phil. Thank you very much for the update on this issue. I didn't know that StringFunctions and ParserFunctions are not installed by default in MediaWiki. I am going to add a note to the install instructions. Thanks. --Rawcoder 07:37, 28 June 2010 (UTC)

Hi; I seem to have the same problem as Phil did but I have verified my String & Parser Function extentions are installed and working (one by testing {{#len:string}} and the other by looking on the Special:Version page. I am running on Debian: MediaWiki 1.15.5-2squeeze2; any ideas what to try next? Thanks - Tom 14:40, 26 January 2012 (UTC)

MediaWiki 1.16 released[edit]

Since 1.16 has been released now it would be really great if this extension could be updated to support it. --Alterego 17:05, 28 July 2010 (UTC)

Saves silently fail[edit]

I'm using MediaWiki v1.15.1 and after editing a new or existing image, the Save silently fails. I'm taken back to the 'page' with the original image unchanged (even after refresh/reloads). There are no error entries in Apache's log nor is there any error in the 'messages' log. Where else can I look?

Did you log in to MediaWiki before creating or editing a drawing? Only logged in users are permitted to upload files.
Did you specify $wgCookieHttpOnly=false in LocalSettings.php? Without it, the applet can not access the current user session.
You may also want to look at the Java console window on the client. Maybe an error message is showing up there.
--Rawcoder 18:31, 20 August 2010 (UTC)
Thanks so much for the pointer to the login - I was already logged in but the problem is login related. "Remember my login on this computer" had to be checked when I login in order for the Save to work properly. Now I need to find out if this can be set to 'checked' by default so my users don't have to remember every time.
There were no messages on the Java Console when the saves failed.

Fatal PHP error, by implementing an image[edit]

Hi. I installed everything like it is described. Howerver, when I try to implement an editable image, e.g. {{#drawing:drawing.svg|250|350}}, I receive a blank page when I save the page. The apache_error_log results the following:

PHP Fatal error: Call to undefined method Title::userCanEdit() in /srv/www/htdocs/extensions/AnyWikiDraw/AnyWikiDraw.php on line 209

It woult be great, if anyone experienced the same problem and alrredy found a solution for this!

  • MediaWiki 1.16.0
  • PHP 5.3.2 (apache2handler)
  • MySQL 5.1.36-log

This happens through a API change in rev 50951 (2009-05-24) of MediaWiki: userCanEdit() was marked since a longer time as deprecated, then removed
--Schwier 23:12, 12 Octobre 2010 (MEZ)

Use this fix (line numbers due to use of Subversion trunk version):

206		$userCanEdit = $wgEnableUploads &&
207                    !$isProtected &&
208                    (is_null($nt) || $nt->userCan('edit')) &&
209                    (is_null($image) || $wgUser->isAllowed( 'reupload' ));

Important change is: $nt->userCanEdit() changed to $nt->userCan('edit')

Saves Fail Silently, the MW 1.16 version[edit]

... but only silently in the browser, showing an empty square where a picture should eventually be. The php log shows the error to be:

[09-Jun-2011 20:28:00] PHP Fatal error:  Cannot access protected property WebRequest::$data in /var/www/sandbox/extensions/AnyWikiDraw/AnyWikiDraw.body.php on line 122

which is in processUpload(), the first of the $wgRequest->data() lines. A few searches suggest that the use of $_GET or $wgRequest->getVal/setVal may help, but so far my newb level with php programming has kept me from finding the right answer. Have any other 1.16 users hit this problem? Thanks for reading. --Skew 20:39, 9 June 2011 (UTC)

Any Updates for MW 1.17?[edit]

Any plans for an update to of this extension for MW 1.17. This is the ideal thing I need, but I cant seem to get the Save functionality to work with my limited PHP knowledge?

I have the extension installed on MW 1.18, using a combination of copying the bugfixes from this page and setting $wgPFEnableStringFunctions = true; to cover for the fact that StringFunctions has been deprecated, removed, and replaced by ParserFunctions. However, it still doesn't save images. I'm working with my hosting provider to get ImageMagick installed, and will report back if that fixes anything.