Skip to content

Commit

Permalink
Add SetResourceLimit function (fixes #107) (#139)
Browse files Browse the repository at this point in the history
* Fix issue #107
* Add ResourceType

add 'RESOURCE_WIDTH', 'RESOURCE_HEIGHT' Resource Type From C API

* gofmt
  • Loading branch information
samt42 authored and justinfx committed Sep 30, 2017
1 parent a641965 commit 65098ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions imagick/magick_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,9 @@ func GetVersion() (version string, nversion uint) {
nversion = uint(cnver)
return
}

// Specify resource limit at package level.
func SetResourceLimit(rtype ResourceType, limit uint64) bool {
ok := C.MagickSetResourceLimit(C.ResourceType(rtype), C.MagickSizeType(limit))
return C.int(ok) == 1
}
2 changes: 2 additions & 0 deletions imagick/resource_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ const (
RESOURCE_THREAD ResourceType = C.ThreadResource
RESOURCE_TIME ResourceType = C.TimeResource
RESOURCE_THROTTLE ResourceType = C.ThrottleResource
RESOURCE_WIDTH ResourceType = C.WidthResource
RESOURCE_HEIGHT ResourceType = C.HeightResource
)

0 comments on commit 65098ff

Please sign in to comment.