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

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
utor
New Member
New Member
Posts: 2
Joined: Thu Jan 28, 2010 12:29 pm

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

Post 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
Last edited by utor on Thu Jan 28, 2010 12:40 pm, edited 1 time in total.
utor
New Member
New Member
Posts: 2
Joined: Thu Jan 28, 2010 12:29 pm

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

Post 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
LadyHLG
Forum Members
Forum Members
Posts: 38
Joined: Wed Apr 21, 2010 1:47 pm

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

Post 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
LadyHLG
Forum Members
Forum Members
Posts: 38
Joined: Wed Apr 21, 2010 1:47 pm

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

Post 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
User avatar
kermit
Power Poster
Power Poster
Posts: 693
Joined: Thu Jan 26, 2006 11:46 am

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

Post 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
Last edited by kermit on Wed Jun 23, 2010 5:46 pm, edited 1 time in total.
eternity (n); 1. infinite time, 2. a seemingly long or endless time, 3. the length of time it takes a frozen pizza to cook when you're starving.
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
LadyHLG
Forum Members
Forum Members
Posts: 38
Joined: Wed Apr 21, 2010 1:47 pm

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

Post 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
LadyHLG
Forum Members
Forum Members
Posts: 38
Joined: Wed Apr 21, 2010 1:47 pm

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

Post 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
Post Reply

Return to “The Lounge”