Problem with cached images with the Designer Content add-on
PermalinkWhen you have an image block (created with the Designer Content add-on), and you select an image for it, it uses a cached version of that image. Normally this is fine, but we've been replacing some of the images on our site with larger, better quality versions, and now whenever we insert one, and try sizing it down to a much smaller size, it crops the edges slightly, which cuts off some important parts.
Does anyone know how to change it so it doesn't call on the cached version of the image?
Thanks
Sorry about that, I should have explained further.
I have a block that basically adds book information. We add a book image, book title, book author, etc. When I created the block, I inserted static HTML around the image block that had a css class, which I put height and width parameters into.
The reason I need it to call on the original image is because this only started happening once we started replacing old images with larger, higher quality versions. We are using the Concrete5 "Replace" method to replace the images. Once we did that, it started cropping the edges. If we use the replace method again, and put the old image back in, it went back to normal. We tried to see if it was the image that was causing the problem (which seems like it is, but I don't know how), but they are both in the same file format (.png), other than that the only difference is that the other one is bigger.
Hope this clarifies. :)
This might be related to caching so always turn off all your concrete5 caching when editing a site and clear your browser(s) cache as well. I have all my browser caching turned off and all concrete5 caching turned off as well while building/editing a site.
Now I'm even more confused. The default Concrete5 Image block also points to the cached file, but it doesn't display in the same way. When I use F12 (on Chromium Browsers), and manually edit the default image block's class to the same class as the other one, the dimensions get edited, but it doesn't do the cropping thing.
Not sure what's going on.
I am now convinved your Designer COntent block is set to crop the picture to have it match the size.
If you check the designer content block the size of the picture is 80x120 while the other one is 73x120. My guess is that you set it to be 80x120 and the actual proportions of the original image doesn't allow to have that exact size without cropping, that's why Designer Content is cropping so you get the exact size and the other one is only resizing so you're getting 73x120.
Look in your Designer Content block in the controller.php file, find the function
public function view()
You will find something like
$this->set('field_1_image', (empty($this->field_1_image_fID) ? null : $this->get_image_object($this->field_1_image_fID, 80, 120, true)));
In which field_1 will have the name of your image field and 80 and 120 will have the values of whatever size you set.
If I am right, the value afte rthe sizes is set to true , in which case just modify the final true to false so it doesn't crop anymore.
It must have been a setting that I set when creating the block, and I didn't realize it.
Thanks for your help, I really appreciate it. :)
I am not sure I understand. Are you using Designer Content resizing feature or are you specifying a size in css or what? Als it doesn't seem to have anything to do with cache.
I am not sure but it sounds as if, when designing the block in Designer Content, you asked for the picture to be resized and cropped to match final size, instead of just resizing.
Your solution would be to redo the block, it will take you 5 minutes of change the code manually so it only resizes and stops croping