[go: up one dir, main page]

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

Fix IMagick with s3 compat #306

Merged
merged 1 commit into from
Apr 16, 2019
Merged

Fix IMagick with s3 compat #306

merged 1 commit into from
Apr 16, 2019

Conversation

joehoyle
Copy link
Member
@joehoyle joehoyle commented Apr 8, 2019

In some cases (it's not that clear how) Imagick is not compatible with remote streams. According to the docs, this has never been possible, but I think it happened to work in the past. I've tried the same version of imagick, on different sets and sometimes works, some times doesnt. The crux of the issue is that IMagick tries to read from the stream, and is sending a SEEK request to something near PHP_MAX_INT, which causes memory allocation issues on our stream wrapper. It's maybe possible to work around it with a seek stream guard, but really I think that's just one of many possible issues. I think it's going to be better to let IMagick always work with local images to avoid issues.

In some cases (it's not that clear how) Imagick is not compatible with remote streams. According to the docs, this has never been possible, but I think it happened to work in the past. I've tried the same version of imagick, on different sets and sometimes works, some times doesnt. The crux of the issue is that IMagick tries to read from the stream, and is sending a SEEK request to something near PHP_MAX_INT, which causes memory allocation issues on our stream wrapper. It's maybe possible to work around it with a seek stream guard, but really I think that's just one of many possible issues. I think it's going to be better to let IMagick always work with local images to avoid issues.
Copy link
@hm-linter hm-linter bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linting failed (1033 errors, 82 warnings).

(1108 notices occurred in your codebase, but were on files/lines not included in this PR.)

@joehoyle joehoyle requested a review from rmccue April 8, 2019 02:05
@codecov-io
Copy link
codecov-io commented Apr 8, 2019

Codecov Report

Merging #306 into master will increase coverage by 1.24%.
The diff coverage is 84.21%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #306      +/-   ##
============================================
+ Coverage     48.39%   49.63%   +1.24%     
- Complexity      248      250       +2     
============================================
  Files             5        5              
  Lines           686      691       +5     
============================================
+ Hits            332      343      +11     
+ Misses          354      348       -6
Impacted Files Coverage Δ Complexity Δ
inc/class-s3-uploads-image-editor-imagick.php 85% <84.21%> (+22.14%) 11 <6> (+2) ⬆️
inc/class-s3-uploads-stream-wrapper.php 57.33% <0%> (-0.28%) 149% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 09b2062...ef1891e. Read the comment docs.

Copy link
Contributor
@roborourke roborourke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good but wondering why the pdf_setup() method is gone now?

*
* @return string|WP_Error File to load or WP_Error on failure.
*/
protected function pdf_setup() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PDF handling is now called in load, and given now we are preparing the the load with a local disk file, this workaround is not longer needed.

@joehoyle joehoyle closed this Apr 16, 2019
@joehoyle joehoyle reopened this Apr 16, 2019
@joehoyle joehoyle merged commit 942eb80 into master Apr 16, 2019
@joehoyle joehoyle deleted the fix-imagick-memory-error branch April 16, 2019 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants