Sign Up! Login: Password: New User? Forgot? Support
Code 
 
 
Forums 
Forums : Archive > Swap out any image
Mottie (SuperAdmin) 7/22/2008 6:09 PM EST : Swap out any image
ACK!
Mottie
Posts: 3883

0
Like

0
Dislike

How to swap out any image

GuildPortal admin site link to original post

I personally don't like the new blog image. To me that's the icon for an RSS feed. So I decided to make this script to swap the image out instead of completely hiding it!

This will actually work with ANY image on your site. Like the ugly control panel image or any of the mail box images.

Setup
  • Find out the name of the original image on the page you want to swap out. This name will replace the text in green.
  • Get the URL of an image with which you want to replace the original. This URL will replace the text in blue.
  • Determine the size of the replacement image. You can adjust the image size or leave it blank for the original image size. Replace the text in red with the desired width and height of your replacement image.
  • The code below is already setup with the "message" and "blog" images, but you may not like the images I chose since I threw them together quickly.
Code
<script type="text/javascript">
var imageswap = new Array();
/*
Add images to swap as follows
imageswap.push (["IMG NAME ON PAGE", "URL TO NEW IMAGE", "WIDTH", "HEIGHT"]);
*/

imageswap.push (["email_add.png", "http://i201.photobucket.com/albums/aa236/Mottie1/testsite/icons/newmail.gif", "16", "16"]);
imageswap.push (["BlogViewBubble.png", "http://i201.photobucket.com/albums/aa236/Mottie1/testsite/icons/blog.gif", "16", "16"]);

// Don't change anything below
// ***************************
function replaceImg() {
var x = document.getElementsByTagName("img");
 try {
  for (j=0; j < x.length; j++) {
   for (k=0; k < imageswap.length; k++) {
    if( x[j].src.match(imageswap[k][0]) ) {
     x[j].src = imageswap[k][1];
     if (imageswap[k][2] != "") x[j].width = imageswap[k][2];;
     if (imageswap[k][3] != "") x[j].height = imageswap[k][3];;
    }
   }
  }
 } catch (err) {}
}
setTimeout("replaceImg();", 1);
</script>
Characters: Mottie Motty Mortie Ooshiny Mot Fudgems
TopBottom

Mottie (SuperAdmin) 7/22/2008 7:05 PM EST : RE: Swap out any image
ACK!
Mottie
Posts: 3883

0
Like

0
Dislike

Well it looks like this isn't required anymore. GuildPortal just added options to hide either of these icons or customize them. But you can still swap out any other image you desire 

Control Panel > Style & Colors > Page Styles

At the bottom there are selections to hide your blog or mail icon, or to replace either with a custom image.

Characters: Mottie Motty Mortie Ooshiny Mot Fudgems
TopBottom

 
 
Key 
New posts No new posts
New posts ( popular ) No new posts ( popular )
New posts ( sticky ) No new posts ( sticky )
New posts ( locked ) No new posts ( locked )
 
 
Who's Online 
There are   members online.
 
 
So-and-so has logged on!
%title%
%message%