SmartImage with Smarty Caching Topic is solved

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
andrewvideouk
Forum Members
Forum Members
Posts: 155
Joined: Thu Aug 20, 2020 10:49 pm

SmartImage with Smarty Caching

Post by andrewvideouk »

HI

Can someone help please. :-D I having big problem that SmartImage is not accepiting variables when I enable Smarty Caching. I get this errors.
But if login in the backend everything is working on the site.

Do SmartImage work with Smarty Caching and how much does it make a diffent when turn on Smarty Caching?

Its does say may interfere with the behaviour of some modules.

Thank you


Cheers

Code: Select all

 Could not find a file at: images/staff/ in
/home/backdrop/public_html/modules/SmartImage/action.default.php
on line
44
or no src is set.

This I trying use in LISE

Code: Select all

  
  
  {SmartImage class="rounded-circle"  src1="images/staff/" src2=$item->picture_person alt={$item->title} } 
  and tried
    {SmartImage class="rounded-circle"  src1="images/staff/" src2={$item->picture_person} alt={$item->title} } 
  
  

This I trying use in CGCalendar

Code: Select all

         {if isset($event.fields)}  
    {foreach $event.fields as $fieldname => $fieldrec}
     {if $fieldname == "Image"}
  {assign var="cal_image" value=$fieldrec.field_value}
      {/if}      
         {if $fieldname == "Image description"}
   {assign var="cal_des" value=$fieldrec.field_value}
      {/if}      
    {/foreach}         
{/if}
 {SmartImage src={$cal_image} alt={$cal_des}  filter_croptofit="300,150" } 
/code]
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: SmartImage with Smarty Caching

Post by Rolf »

Safe yourself a lot of time and headaches: disable Smarty Caching. To get this working like it was designed to, you have to do much more then only enable it in the Admin panel. Several (page) templates need to be changed to stop caching some content. Not worth the fuss, imnsho
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm
Location: Nimbin, Australia

Re: SmartImage with Smarty Caching

Post by rotezecke »

I recognise the error message. in my case, not smarty caching related.
SmartImage is very particular about paths.

viewtopic.php?f=7&t=82989
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: SmartImage with Smarty Caching

Post by velden »

Totally unrelated but I noticed it multiple times.

Don't use the foreach loops to iterate fields in your templates. It's just meant for sample templates because the developer doesn't know which fields you will be defining.

It's like opening every door of your kitchen cabinets every time you need a coffee cup and ask yourself "are the cups here?".
I assume you know where to find the cups so just open that door.

Try something like (untested):

Code: Select all

{SmartImage src=$event.fields['Image'].field_value alt=$event.fields['Image description'].field_value  filter_croptofit="300,150" } 
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: SmartImage with Smarty Caching

Post by velden »

BTW: there's an assumed bug in SmartImage: http://dev.cmsmadesimple.org/bug/view/12472
Though it seems unrelated to your case.
andrewvideouk
Forum Members
Forum Members
Posts: 155
Joined: Thu Aug 20, 2020 10:49 pm

Re: SmartImage with Smarty Caching

Post by andrewvideouk »

Thank you. That's really useful. I hate foreach loops but I didn't really know how to call the variables if they were file uploads and I couldnt work out how to call variables with spaces in them. I will test the code you have given me and disable Smarty Caching if not really needed,

Code: Select all

{SmartImage src=$event.fields['Image'].field_value alt=$event.fields['Image description'].field_value  filter_croptofit="300,150" } 
Without you guys there's no way I could of got this far. I have been making this website for a learning disability group it has taken me a year to make but I have learnt so much. I have a learning disability too so it is hard to learn new things. At the same time I had long nights trying to work how to make codes work on the site. I would like to say a big thank you to you guys and its really appreciated all the help you have given me so far. I am a volunteer for a group and they have no money to pay someone to build a site for them. That's why I said I would help them. Your help goes a long way. Thank you

I am almost there as I need the site to be done by march as they are doing a digital event for people with learning disabilities to get them on the web.
Post Reply

Return to “Modules/Add-Ons”