# Fwd: image\_tag keeping add ? after the url it generates

**URL:** <https://www.ruby-forum.com/t/fwd-image-tag-keeping-add-after-the-url-it-generates/66230>\
**Category:** Rails\
**Created:** [August 24, 2006, 6:17am UTC](https://www.ruby-forum.com/t/fwd-image-tag-keeping-add-after-the-url-it-generates/66230 "2006-08-24T06:17:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zhenjian\_YU](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/bcef8e/32.png) [@Zhenjian\_YU](https://www.ruby-forum.com/u/Zhenjian_YU)\
**Post date:** [August 24, 2006, 6:17am UTC](https://www.ruby-forum.com/t/fwd-image-tag-keeping-add-after-the-url-it-generates/66230/1 "2006-08-24T06:17:09Z")

</div>

hi, all,

I have a problem with image\_tag, the url it generates keeps adding ???  
at  
the tail.

e.g.  
src="/images/gicon.jpg?1153577588???"  
src="/images/gicon.jpg?1153577588???"

I’ve checked the source code of image\_tag, and couldn’t find any  
solution.  
The ???  
is appended to the “source” parameter before it goes to the real  
image\_tag  
code.

```
  def image_tag(source, options = {})
    puts source # already ????? here
    options.symbolize_keys!

    options[:src] = image_path(source)
    options[:alt] ||= File.basename (options[:src],

```

‘.\*’).split(’.’).first.capitalize

```
    if options[:size]
      options[:width], options[:height] = options[:size].split("x")
      options.delete :size
    end

    tag("img", options)
  end

```

I couldn’t debug further because I couldn’t find where the image\_tag was  
invoked.  
I think maybe it’s caused by encoding problem because I use utf8 as the  
default encoding for the project.

Anyone has a solution?

Best Regards,  
Zhenjian

---

<div class="post-metadata">

**Author:** ![Zhenjian\_YU](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/bcef8e/32.png) [@Zhenjian\_YU](https://www.ruby-forum.com/u/Zhenjian_YU)\
**Post date:** [August 24, 2006, 10:11am UTC](https://www.ruby-forum.com/t/fwd-image-tag-keeping-add-after-the-url-it-generates/66230/2 "2006-08-24T10:11:30Z")

</div>

> Anyone has a solution?

Yes, leave it, it’s a feature. It will cause your user’s browser to  
reload the image whenever it changes and get it from the cache if no  
change was made. The parameter is the modification date.

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![Zhenjian\_YU](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/bcef8e/32.png) [@Zhenjian\_YU](https://www.ruby-forum.com/u/Zhenjian_YU)\
**Post date:** [August 24, 2006, 10:41am UTC](https://www.ruby-forum.com/t/fwd-image-tag-keeping-add-after-the-url-it-generates/66230/3 "2006-08-24T10:41:33Z")

</div>

yes, I know that the timestamp figure is the feature. I’m wondering how  
does  
those ??? (question signs) come out?  
When a page with many images is loaded, there are so many  
???  
(question signs) apear and make the page  
size really big. I want to find a way to get rid of these  
???  
(question signs).

Regards,  
Castor

---

<div class="post-metadata">

**Author:** ![Zhenjian\_YU](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/bcef8e/32.png) [@Zhenjian\_YU](https://www.ruby-forum.com/u/Zhenjian_YU)\
**Post date:** [August 24, 2006, 11:31am UTC](https://www.ruby-forum.com/t/fwd-image-tag-keeping-add-after-the-url-it-generates/66230/4 "2006-08-24T11:31:39Z")

</div>

That’s weird indeed, I’ve never come across this.

On 24 Aug 2006, at 10:31, Zhenjian YU wrote:

> On 8/24/06, Peter De Berdt \< removed\_email\_address@domain.invalid\> wrote:
> 
> > Anyone has a solution?
> 
> Yes, leave it, it’s a feature. It will cause your user’s browser to  
> reload the image whenever it changes and get it from the cache if  
> no change was made. The parameter is the modification date.

> 

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![Zhenjian\_YU](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/bcef8e/32.png) [@Zhenjian\_YU](https://www.ruby-forum.com/u/Zhenjian_YU)\
**Post date:** [August 25, 2006, 3:39am UTC](https://www.ruby-forum.com/t/fwd-image-tag-keeping-add-after-the-url-it-generates/66230/5 "2006-08-25T03:39:40Z")

</div>

ok, I solved this by modifying the source code of image\_tag as follows

```
   new_source = image_path(source)
   new_source.gsub!(/\?\?+/,'') # strip the ending ???? here
   options[:src] = new_source
```

---

<div class="post-metadata">

**Author:** ![Zhenjian\_YU](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/bcef8e/32.png) [@Zhenjian\_YU](https://www.ruby-forum.com/u/Zhenjian_YU)\
**Post date:** [August 24, 2006, 11:53am UTC](https://www.ruby-forum.com/t/fwd-image-tag-keeping-add-after-the-url-it-generates/66230/6 "2006-08-24T11:53:40Z")

</div>

I plan to modify the source code of image\_tag to strip out those  
question  
signs if there weren’t any better solution.
