Closed p-a-s-c-a-l closed 4 years ago
Include in report button for iFrames is implemented and can be tested e.g. here. However, unfortunately html2canvas creates a blank snapshot of the iframe.
So instead of the iFrame as a whole, we maybe have to select an element within the iFrame as described here.
Tried with this study, but got:
error posting report image
It would be helpful to log the concrete error in csis_include_in_report.js#L168
True, I was expecting the Drupal logger to log such errors, but he doesn't. I will log the error messages directly in the script.
The image file itself is created, but it fails when creating the Report Image entity, so I'm guessing that's because there is no GL-step available on that page to which the Report Image could be linked.
I need to add it directly to the Study group, but I remember there were some issues with JSON:API altering Group instances. Was couple of months ago, might have been solved by now. I will look into this.
I'm guessing that's because there is no GL-step available on that page to which the Report Image could be linked.
Yes, this should be the problem now.
First, the request to create the Report Image Entity answered with a 413 Request Entity too large
, but since this is solved, the request answers with a 404 The resource identified by 'node--gl_step:-1' (given as a relationship item) could not be found
Status @therter ? What's going on in this branch: bug/9_use_table_div?
Answer is here
Is there a possibility to increase the resolution of the snapshot? This snapshot image is even smaller than the original map shown on the screen. For printing, this is not suitable.
Please note the URI of the image: /sites/default/files/styles/max_650x650/. So for some reason the size is limited to max. 650x650px when uploading (?) the image. Is this a restriction at Drupal side or at html2canvas side?
Is there a possibility to increase the resolution of the snapshot? This snapshot image is even smaller than the original map shown on the screen. For printing, this is not suitable.
Please note the URI of the image: /sites/default/files/styles/max_650x650/. So for some reason the size is limited to max. 650x650px when uploading (?) the image. Is this a restriction at Drupal side or at html2canvas side?
No, this is not a Drupal or html2canvas restriction, that's just how drupal handles images. The original image taken by html2canvas is this one (your previous URI without the "/styles/max_650x650/public").
Drupal allows to define different image styles, which you can then use in either Views or display modes. That will determine how the image will be shown in the FE.
AFAIK we use the default style (so the original image resolution) on all report images. Since you managed to find one in a 650x650 resolution, I guess we have a misconfiguration somewhere.
@p-a-s-c-a-l Where exactly did you find this image being displayed?
So for some reason the size is limited to max. 650x650px when uploading (?) the image. Is this a restriction at Drupal side or at html2canvas side?
On html2canvas side, it is possible to increase the resolution of the image with the scale option. But drupal does not accept such images, because they are too large.
In my local instance, I get the following error message:
Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException: Unprocessable Entity: file validation failed. The file is 2.39 MB exceeding the maximum file size of 2 MB. in Drupal\jsonapi\Controller\FileUpload->handleFileUploadForNewResource() (line 177 of /app/web/core/modules/jsonapi/src/Controller/FileUpload.php).
I will try to increase the allowed file size locally to test images with a higher resolution.
So for some reason the size is limited to max. 650x650px when uploading (?) the image. Is this a restriction at Drupal side or at html2canvas side?
On html2canvas side, it is possible to increase the resolution of the image with the scale option. But drupal does not accept such images, because they are too large.
Oh interesting, I didn't know that. But where is this currently applied? I just took a screenshot of the Study Area for Study 30 and one screenshot of the hazard map. In both cases (image 1, image 2) html2canvas created the images with the same resolution as shown on the website.
But where is this currently applied?
Since the drupal system currently does not accept large images, this isn't applied, yet.
Where exactly did you find this image being displayed?
Right after clicking the include in report button and on preview. So the 650x650 resolution is probably o.k,. for preview mode and we don't have to change it as long as the full resolution is available in the (PDF) report.
But where is this currently applied?
Since the drupal system currently does not accept large images, this isn't applied, yet.
Oh my mistake, I though you said that html2canvas is currently limiting the resolution to 650x650.
Where exactly did you find this image being displayed?
Right after clicking the include in report button and on preview. So the 650x650 resolution is probably o.k,. for preview mode and we don't have to change it as long as the full resolution is available in the (PDF) report.
Ah right. Denis just recently included the image in the edit form of the report image and set the formatter style to 650x650. However, that does not impact how the image is later shown in the PDF, so we don't need to fix that.
To allow the upload of bigger images, the file /usr/local/etc/php/conf.d/uploads.ini has to be created. The content of the file should be something like this:
file_uploads = On
memory_limit = 64M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 600
To allow the upload of bigger images, the file /usr/local/etc/php/conf.d/uploads.ini has to be created.
@therter What's the status? How is this solved within our drupal docker container?
I have added the file upload.ini to the docker-compose.yml. The attempts with the configuration in the folder /app/web/sites/default did not work
Implemented. But there is still a bug.
We need iFrame support in csis_include_in_report.js.
Not sure if that's going to work. We can try it with the MCDA App (which is currently broken) until iFrame Support for the Map Component is available.