Page 1 of 1

[Solved] CGSmartImage latest version path problem

Posted: Mon Feb 04, 2013 11:45 am
by hgpdesign
We've upgraded the CGSmartImage module to the latest version. Now we have path problem causing the not embedded images (noembed=1) not to show up. Since we mainly do photo-sites this is causing a big problem for us. When we look to the source code we see something 'funny'.

Our code (in a News summary template):

Code: Select all

{foreach from=$items item=entry name=foo}
{capture assign='category_page'}{$entry->category|replace:' ':'-'|lower}{/capture}

{assign var=loc value=$entry->file_location}
{assign var=img1 value=$entry->fields.image1->value}
{assign var=img2 value=$entry->fields.image2->value}
{assign var=img3 value=$entry->fields.image3->value}
{capture assign='num'}image{if $img3 !=''}{1|rand:3}{elseif $img2 !=''}{1|rand:2}{else}1{/if}{/capture}
{assign var=img value=$entry->fields.$num->value}

<div class="{if $smarty.foreach.foo.iteration % 4==0}sum_main_right{else}sum_main{/if}">
   <a href="{$entry->link|regex_replace:'/returnid=[0-9]*/':"returnid=$category_page"}">
   {CGSmartImage src="$loc/$img" filter_croptofit='225,140,tc' quality='100' noembed=1}

etc.

CGSmartImage outputs:

Code: Select all

   <img src="http://ourdomain.nl/uploads/uploads/_CGSmartImage/IMG_2217-f33faa2fb22699bee5e5c99bde057d73.jpg" width="225" height="140" alt="IMG_2217-f33faa2fb22699bee5e5c99bde057d73.jpg"/>
Note the directory "/uploads" is mentioned twice, causing the path to be wrong. We have not altered our code, we've only upgraded the CGSmartImage module...

We have other photo-sites on which we have not done the upgrade of the CGSmartImage module and there it outputs something like this:

Code: Select all

   <img class="img-link" src="http://anotherdomain.nl/uploads/_CGSmartImage/IMG_1460-32610a890372c6b80821a00e6ec4f802.jpg" width="606" height="400" alt="IMG_1460-32610a890372c6b80821a00e6ec4f802.jpg"/>
Here we have no problem.

What, if so, are we doing wrong en what can we do about it?
Because of the 'random image feature' embedding is not an option for us.


Thanks in advance.

Ron Hoenson
HGPDESiGN

Re: CGSmartImage latest version path problem

Posted: Mon Feb 04, 2013 11:56 am
by uniqu3
Go to module settings and update the url prefix field, thats where second /uploads is coming from.

Re: CGSmartImage latest version path problem

Posted: Mon Feb 04, 2013 12:39 pm
by hgpdesign
That did the trick!


Thank you very much.


Kind regards,

Ron Hoenson

Re: [Solved] CGSmartImage latest version path problem

Posted: Fri Feb 08, 2013 2:42 am
by mel
Thanks to solve my problem. Just to precise, module version causing this change is 1.10.1

Re: [Solved] CGSmartImage latest version path problem

Posted: Sun Feb 10, 2013 8:11 pm
by mel
Changed my mind. It works for existing images in cache. But I can generate any new ones, as they are not saved in "uploads/_CGSmartImage" but in "/_CGSmartImage"
I don't really understand what I should change exactly.
If I put this :

Code: Select all

Cache Path: _CGSmartImage
 Cache path for cache images to be stored. Cache path is relative to config reference "root_path".
Préfixe de l'URL de l'image : http://localhost/mlecms/uploads
Images are saved in "localhost/_CGSmartImage"
But the href of the image is "http://localhost/mlecms/uploads/_CGSmar ... 8b7f3e.jpg"

What I should changed?
  • All my calls <img src="{CGSmartImage src=$entry->file_location|cat:'/'|cat:$field->value noembed=1 notag=1}" /> onto what?
  • Or those cache url? but by what? uploads/_CGSmartImage returns back to this double uploads in url