Our site is also experiencing this issue. All of our forms break randomly which causes great frustration. Any updates here?
Hi Nathanael,
Adding in those params to the BF URL took a >1MB image down to <200kB! Seeing similar results across the board. Thanks for the help, that was a huge win. We will implement something like your other suggestion as well.
We were also curious, what is the intention of Webhook integration if the images aren't being downloaded?
Thanks,
Chase
Hi Nathanael,
Our site utilizes a custom theme that completely overwrites the templates for different types of content, primarily from the Paragraphs module. In order to retrieve the URL from the Brandfolder CDN to use in these templates we have a custom service with this function:
/**
* Get Brandfolder image url using BF imagefactory.
*/
public static function getUrl($media) {
$field_id = 'field_brandfolder_attachment_id';
if (!empty($media) && $media->hasField($field_id) && !$media->get($field_id)->isEmpty()) {
$bf_id = $media->get($field_id)->getValue()[0]['value'];
$fid = brandfolder_map_attachment_to_file($bf_id);
$file = File::load($fid);
$url = $file->createFileUrl();
return $url;
}
/* Return non-BF asset url. */
return file_create_url($media->field_media_image->entity->uri->value);
}
This service is then called in preprocess hooks to pass the URLs to templates to be displayed in img
elements. The idea is that content authors can upload images to Brandfolder and select them as media when choosing images for paragraphs. However this approach is causing some technical overhead and seems to be bypassing any sort of image optimization that may traditionally occur with this module, resulting in 1mb+ image downloads from https://cdn.bfldr.com.
Would love to discuss our use case more in depth to see if there's a better way to accomplish this.
Thanks,
Chase
Hi Nathanael,
Our site utilizes a custom theme that completely overwrites the templates for different types of content, primarily through the Paragraphs module. In order to retrieve the URL from the Brandfolder CDN to use in these templates we have a custom service with this function:
/**
* Get Brandfolder image url using BF imagefactory.
*/
public static function getUrl($media) {
$field_id = 'field_brandfolder_attachment_id';
if (!empty($media) && $media->hasField($field_id) && !$media->get($field_id)->isEmpty()) {
$bf_id = $media->get($field_id)->getValue()[0]['value'];
$fid = brandfolder_map_attachment_to_file($bf_id);
$file = File::load($fid);
$url = $file->createFileUrl();
return $url;
}
/* Return non-BF asset url. */
return file_create_url($media->field_media_image->entity->uri->value);
}
This service is then called in preprocess hooks to pass the URLs to templates to be displayed in img
elements. The idea is that content authors can upload images to Brandfolder and select them as media when choosing images for paragraphs. However this approach is causing some technical overhead and seems to be bypassing any sort of image optimization that may traditionally occur with this module, resulting in 1mb+ image downloads from https://cdn.bfldr.com.
Would love to discuss our use case more in depth to see if there's a better way to accomplish this.
Thanks,
Chase
cbrand02 → created an issue.