Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include iFrames in Report #13

Closed
p-a-s-c-a-l opened this issue Aug 23, 2019 · 17 comments
Closed

Include iFrames in Report #13

p-a-s-c-a-l opened this issue Aug 23, 2019 · 17 comments
Assignees
Labels
BB: Report Generation Report Generation Building Block BB: UI Integration Platform UI Integration Platform Building Block enhancement New feature or request

Comments

@p-a-s-c-a-l
Copy link
Member

p-a-s-c-a-l commented Aug 23, 2019

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.

@p-a-s-c-a-l
Copy link
Member Author

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.

@p-a-s-c-a-l
Copy link
Member Author

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

@patrickkaleta
Copy link
Contributor

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.

@therter
Copy link
Contributor

therter commented Sep 6, 2019

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

@p-a-s-c-a-l
Copy link
Member Author

p-a-s-c-a-l commented Sep 25, 2019

Status @therter ?
What's going on in this branch: bug/9_use_table_div?

Answer is here

@p-a-s-c-a-l
Copy link
Member Author

p-a-s-c-a-l commented Sep 26, 2019

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?

@patrickkaleta
Copy link
Contributor

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.
image-styles

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?

@therter
Copy link
Contributor

therter commented Sep 26, 2019

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.

@patrickkaleta
Copy link
Contributor

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.

@therter
Copy link
Contributor

therter commented Sep 26, 2019

But where is this currently applied?

Since the drupal system currently does not accept large images, this isn't applied, yet.

@p-a-s-c-a-l
Copy link
Member Author

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.

@patrickkaleta
Copy link
Contributor

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.

@patrickkaleta
Copy link
Contributor

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.

@therter
Copy link
Contributor

therter commented Sep 27, 2019

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

@p-a-s-c-a-l p-a-s-c-a-l moved this from Backlog: High Priority to In Progress in T1.3 Climate Services Co-creation Oct 11, 2019
@p-a-s-c-a-l
Copy link
Member Author

p-a-s-c-a-l commented Oct 11, 2019

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?

@therter
Copy link
Contributor

therter commented Oct 11, 2019

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

@p-a-s-c-a-l
Copy link
Member Author

Implemented. But there is still a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BB: Report Generation Report Generation Building Block BB: UI Integration Platform UI Integration Platform Building Block enhancement New feature or request
Projects
No open projects
Development

No branches or pull requests

3 participants