When attempting to retrieve an image resource's original image, a 404 is returned. That is because the resource type requested is "RAW" if "styles" was not in the request.
An example URI would be $file_uri = 'cloudinary://skus/123456789/123456789-primary.jpg';.
The logic here requests an image resource if styles is in the path.
if (in_array('sample.png', $paths) && strpos($uri, 'styles')) {
$public_id = 'styles/' . $style_name . '/' . $scheme . '/' . $public_id;
}
$resource = cloudinary_stream_wrapper_resource($public_id, array('resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_IMAGE));
However, later on, it is requested as raw if there are no "styles"
elseif (!$this->resource || $reset) {
$public_id = $this->getPublicId($uri);
$this->resource = cloudinary_stream_wrapper_resource($public_id, array('resource_type' => CLOUDINARY_STREAM_WRAPPER_RESOURCE_RAW));
}
Comments
Comment #2
mglamanThis fixes retrieving images.
Comment #3
lquessenberry commentedHello all. This patch works. I would like to discuss maintaining this module for 8.x if anyone is interested in doing so.