Add option for file path prefix + add followlocation option to curl calls #67
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue, and adds a new feature.
Fix:
Add
CURLOPT_FOLLOWLOCATION
to remote image curl calls to allow curl to follow redirects (e.g. 301) on the remote url.(fixes issue #56)
Feature:
Add
filePathPrefix
option to enable a prefix for the output image path. This option can be used in the snippet call options parameter, for example:[[pThumb?&input=`https://test.com/my-image.jpg`&options=`&w=300&h=300&filePathPrefix=[[*id]]`]]
Which will result in adding the resource id in the output file path (using resource ID 1 as an example):
assets/image-cache/1/my-image.jpg
This is a welcome addition when handling large amounts of images where the source images are all in the same folder, which results in the image-cache folder having a lot of items, and it also makes pthumb slower with checking existing files and generating thumbnails since it has to navigate through this large folder.