Skip to content

Conversation

@muno92
Copy link
Contributor

@muno92 muno92 commented Dec 3, 2022

Unit of Imagick::getResourceLimit returns value is following, not megabytes.

  • bytes
    • disk
    • map
    • memory
  • pixel
    • area
  • count
    • file
    • thread
    • throttle
  • seconds
    • time

Sample

Version of ImageMagick

ImageMagick 6.9.11-60 Q16 aarch64

policy.xml

  <policy domain="resource" name="area" value="1MP"/>
  <policy domain="resource" name="disk" value="2GiB"/>
  <policy domain="resource" name="file" value="3"/>
  <policy domain="resource" name="map" value="4MiB"/>
  <policy domain="resource" name="memory" value="5MiB"/>
  <policy domain="resource" name="thread" value="1"/> 
  <policy domain="resource" name="time" value="7"/> 
  <policy domain="resource" name="throttle" value="8"/> 

Test script

echo "Area: " . Imagick::getResourceLimit(Imagick::RESOURCETYPE_AREA) . PHP_EOL;
echo "Disk: " . Imagick::getResourceLimit(Imagick::RESOURCETYPE_DISK) . PHP_EOL;
echo "File: " . Imagick::getResourceLimit(Imagick::RESOURCETYPE_FILE) . PHP_EOL;
echo "Map: " . Imagick::getResourceLimit(Imagick::RESOURCETYPE_MAP) . PHP_EOL;
echo "Memory: " . Imagick::getResourceLimit(Imagick::RESOURCETYPE_MEMORY) . PHP_EOL;
echo "Thread: " . Imagick::getResourceLimit(Imagick::RESOURCETYPE_THREAD) . PHP_EOL;
echo "Time: " . Imagick::getResourceLimit(Imagick::RESOURCETYPE_TIME) . PHP_EOL;
echo "Throttle: " . Imagick::getResourceLimit(Imagick::RESOURCETYPE_THROTTLE) . PHP_EOL;

Output

Area: 1000000
Disk: 2147483648
File: 3
Map: 4194304
Memory: 5242880
Thread: 1
Time: 7
Throttle: 8

@Girgias
Copy link
Member

Girgias commented Dec 3, 2022

@Danack could you have a look?

@muno92
Copy link
Contributor Author

muno92 commented Jan 6, 2023

@Danack Could you review this pull request?

@jimwins
Copy link
Member

jimwins commented Sep 29, 2024

This is obviously correct based on the documentation for Imagick::setResourceLimit, no need to keep waiting for a review.

@jimwins jimwins merged commit 3f91a99 into php:master Sep 29, 2024
@muno92 muno92 deleted the fix-imagick-getresourcelimit branch September 29, 2024 01:10
@muno92
Copy link
Contributor Author

muno92 commented Sep 29, 2024

@jimwins
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants