image_tag keeping add ???? after the url it generates

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

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

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

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

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

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