Images breaking in Knowledge Articles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2012 08:09 AM
Over the weekend we noticed that a bunch of screenshots in a knowledge article broke. We assumed something strange had happened during the image upload, so we deleted the images and started over. For the first couple of views, it worked fine, but they quickly broke again.
When viewing the URL of a broken image, it was entirely different from normal image url. It contained all kinds of garbage "span" code.
The only similarity between the three images is that they all contained the word "bookmark". On a whim we decided to rename each of the images without the text "bookmark" and re-upload. Now all the images are working fine.
So I know there's at least one "reserved word" I shouldn't use when uploading pictures for use in KB articles. Are there any more I should look out for? Or should I avoid naming pictures with words at all?
- Labels:
-
Knowledge Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2014 08:26 AM
Hi Hal,
What option did you end up choosing?
We are facing the same issue but I am afraid that another upgrade will come with couple of unnoticed changes...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2014 10:08 AM
We ran a couple scripts to repair links that stopped working after the update.
Here is some sample code. Use at your own risk!
First, rename image files. We had about 1000 of these. file.ABCx ==> file.abcx
gr = new GlideRecord('db_image');
gr.query();
changed = 0;
while(gr.next()) {
name = gr.name;
// you may want regexes that are more specific
if (name.match(/\.[A-Z]{3}$/)) {
new_name = name.replace(/\.([A-Z]{3})x?$/, function(v) { return v.toLowerCase(); });
gs.print(name + " -> " + new_name);
gr.name = new_name;
// only uncomment next line after you are sure what this script does
//gr.update();
changed++; }
}
gs.print(changed+' records changed');
Second, change the links. Hundreds of articles.
gr = new GlideRecord('kb_knowledge');
gr.query();
changed = 0;
while(gr.next()) {
t1 = gr.getValue('text');
if (JSUtil.notNil(t1) && (t1.match(".PNGx") || t1.match(".JPGx"))) {
gs.print(gr.number);
t2 = t1.replace(".PNGx",".pngx","g");
t3 = t2.replace(".JPGx",".jpgx","g");
gr.text = t3;
// only uncomment next line after you are sure what this script does
//gr.update();
changed++;
}
}
gs.print(changed+' records changed');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2015 11:08 PM
Thanks!
We've ended up modifying your script instead of upgrading the instance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2014 10:13 AM
Note: I marked this old thread (which was migrated from our previous community platform) as a Question, so replies can now be marked as Correct or Helpful as needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2014 10:17 AM
One way to ensure that your images won't "break" is to convert them to base64. We've had great success with doing this in our KB. Here's how:
Convert images to base64 strings for HTML/CSS embedding