Wikifab / wikifab-main

Follow this tutorial to install you own Wikifab
Other
82 stars 21 forks source link

Images not showing annotations (Missing in Forms template?) #28

Closed pomeroyb closed 4 years ago

pomeroyb commented 4 years ago

I have been working to install WikiFab to use as internal documentation at our work, and it has solved a lot of problems for us! The only thing that's not working for me is the ImageAnnotator. I can open the annotator and add arrows and circles in the popup window:

But when I click "Save", the annotations do no show up:

image

I have error reporting turned on in LocalSettings.php: `error_reporting( -1 );

ini_set( 'display_errors', 1 );`

And I am not getting any errors. The annotations are being saved, because opening the annotator again will show the same circles and arrows being drawn.

When I init wikifab, I use the following:

sudo php maintenance/initWikifab.php --setWikifabHomePage

Which (I believe) uses the english version of "Template_Tuto_StepImage.txt.

That file does not use the "#annotatedImage" tag described on the Image Annotator Extension.

I have also tried using: sudo php maintenance/initWikifab.php --setWikifabHomePage --int

Which (I believe) uses the international version of "Template_Tuto_StepImage.txt. This file does use the "#annotatedImage" tag, but I still do not see the annotations when the site is switched to that.

Please let me know if there is anything I am missing, I would appreciate the help! :)

pomeroyb commented 4 years ago

Update to this:

I have reinstalled Wikifab using Method 1 from the README, using the 1.2.0-beta. Still no ImageAnnotator :(

It is now looking like the annotator is not creating the annotation thumbnails -- I see the div class="annotatedcontent" in the page source on a tutorial, but the img class ="annotationlayer" (That I see on the official WikiFab.org site) does not show up on my site.

I have also attempted to update the ImageAnnotator extension by extracting it from Github into my /extensions/ImageAnnotator/ folder, and running maintenance/update.php.

I did get some new behaviour: now whenever an image has an annotation, it shows the following: image

That loading overlay never goes away, however.

Any ideas?

pomeroyb commented 4 years ago

Finally worked up the courage to find out this bug. This was tedious to find!

I installed a fresh install of Wikifab using Method 2 from the README. I first rolled back ImageAnnotator to version 1.1.0 (The same version, supposedly, that is installed on the wikifab.org website, as seen on the Versions page). Side note: I believe that's another bug with the Packagist repo -- the version number never changes

That worked for me, but it was pretty out of date. I then went forward, one commit at a time, to find the change that broke.

The broken commit is "Add API for annotated images".

If you are on the above branch, no annotated image is generated or shown, you just get the regular thumbnail of your image. A later commit (I didn't bother finding exactly which one) adds the loading overlay from the above post, but the problem persists.

To get the correct version when you run composer, first open composer.local.json:

$ cd /var/www/yourwebsite
$ nano composer.local.json

Change image-annotator to version 1.1.0 specifically:

"wikifab/image-annotator": "dev-master#d0f2dc9ef873bb3763bef769ac55773d564285e3",

This is only a partial fix, however. It works for the Main Picture perfectly, but it appears there are still some issues when trying to display the annotated images in the steps. Will have to keep pushing on this. to make it work.

pomeroyb commented 4 years ago

Aha, finally tracked this down!

The issue is line 250 of ApiImageAnnotatorThumb.php

// convert to png :
$cmd = "inkscape -z -f ". escapeshellarg ($svgInFile) ." -w $width --export-background-opacity=0,0 --export-png=". escapeshellarg ($fileOut) ."";

I did not have inkscape installed on my distro 🤦‍♀

Running $ sudo apt install inkscape

Solved this issue. Perhaps this requirement should be added to the Readme?