form
form copied to clipboard
BUGFIX: Also add images as email attachment
Previously:
When a user is using the image upload component in a form in combination with the email finisher where "Attach all uploaded files" was checked, the image was not attached to the email.
Now:
When the user now uses the image upload with the email finisher and "Attach all uploaded files" was checked, the image is attached to the email.
What I did:
- when an image upload is used the type of the form value is not a PersistentResource, it's an Image, so I added a check for this case in the addAttachment function
- when it is an image we have to first get the resource to get to the stream of the image
- in addition I added a check if the steam we got is really of type resource because
stream_get_contents()only accepts resources and the stream could return a boolean value