Page 1 of 1

{content_image} myimage? shows only if I "reload"

Posted: Thu Jan 28, 2010 12:38 pm
by utor
i am using the {content_image} function in a template to show different myimage? on every page. but the image doesn`t load directly, when it is the first call of the page. after a reload the picture shows up.

i used {content_image block='MyImage?' dir='images'} to put the pictures on the page. what can i do?

btw, cmsms AND the community are incredibly helpful!
keep up the great work thx alot in advance!

utor

Re: {content_image} myimage? shows only if I "reload"

Posted: Wed Feb 03, 2010 11:44 am
by utor
i "solved" the problem by using javascript window.location.reload(); but i dont`t think that`s the last word in this. anyone some better idea, maybe?

;)
thx
utor

Re: {content_image} myimage? shows only if I "reload"

Posted: Tue Jun 22, 2010 9:52 pm
by LadyHLG
I too have seen this problem.
I have done a bit of looking at the code and here is what I am seeing.
If I do a view source in Firefox the image code looks ok

Code: Select all

<!-- Begin Header Image-->
         <div id="header">
                 
                 <img src="uploads/images/pageheaders/mainimage21.jpg" name="HeaderImage" alt="Header Image." /> 
         </div>
However, because firefox creates a clickable link in the view source code to view the image, if I click it it actually tries to path to the following:

Code: Select all

http://dell-4/sandbox/%EF%BB%BFuploads/images/pageheaders/mainimage21.jpg
Obviously the %EF%BB%BF isnt supposed to be there. As utor mentioned above this only happens on the first page load. If the page is refreshed then the image usually loads.
Does anyone have any ideas on how to correct this?

LadyHLG

Re: {content_image} myimage? shows only if I "reload"

Posted: Wed Jun 23, 2010 5:21 pm
by LadyHLG
I wanted to share a bit about what I have found and my possible solution.

I believe this behavior has something to do with Smarty and caching, but as I am just now learning CMSMS and Smarty I really dont have a clue as to what is happening or why, perhaps someone with a better understanding of both can offer some insight.

From what I see those special characters are not in the database record for the content_image variable which is why I thought maybe somehow smarty was introducing them, but again, I cant be completely sure.

My fix, which seems to be working (so far with testing) was to add the following at about line 33 of the function.content_image.php file:

Code: Select all

$result = filter_var($result, FILTER_SANITIZE_URL);
That would be just after:

Code: Select all

$result = $smarty->fetch(str_replace(' ', '_', 'content:' . $params['block']), '', $pageinfo->content_id);
I do hope someone a bit more in the know can at least confirm this was a reasonable solution.

Thanks
LadyHLG

Re: {content_image} myimage? shows only if I "reload"

Posted: Wed Jun 23, 2010 5:43 pm
by kermit
that's utf-8 BOM (byte order mark).. you need to figure out where it's coming from.

someone else had a similar issue recently
http://forum.cmsmadesimple.org/index.ph ... 004.0.html

Re: {content_image} myimage? shows only if I "reload"

Posted: Wed Jun 23, 2010 7:16 pm
by LadyHLG
kermit,
Thank-you for pointing to the other thread!
I didnt see it during my searches on the issue (of course I had no idea what to look for..)
It looks like the TrueTypeText mod is the cause of the issue, and now I am wondering is that BOM is why that mod does not work for Firefox?
So how do I find it in the mod?

LadyHLG

Re: {content_image} myimage? shows only if I "reload" [Solved]

Posted: Wed Jun 23, 2010 7:57 pm
by LadyHLG
Another update - I used a BOM detector to search through the files for the TrueTypeText Mod and it found BOM's at the beginning of 26 different files.
After removing them the problem with the images defiantly went away, however the mod still does not work in Firefox, so apparently there are still other issues with it.

LadyHLG