Advertise Here

Author Topic: [Code] Swap Images on Page  (Read 19204 times)

0 Members and 1 Guest are viewing this topic.

Offline webworldx

  • Code Master's
  • *
  • Posts: 31
    • View Profile
    • InvisionFusion

  • Total Badges: 15
    Badges: (View All)
    Windows User Topic Starter Combination Level 3 Level 2
[Code] Swap Images on Page
« on: December 11, 2006, 04:44:22 pm »
Use this Swap Images Generator to swap your images:

http://www.ifcode.com/javascript/ImageSwapSMF.html

Hope that helps you - just add in the URL's into the boxes at the top, then generate the code.  Should be a bit easier.

The generator generates a code that swaps any image on your forum with a new image.

The current image on your forum goes under the "Old Image" column.
The image you want to replace that image goes across from it in the "New Image" column.

Stick the code that is generated into your FOOTERS. (AdminCP->Manage Styles->Edit Headers/Footers)


« Last Edit: May 29, 2009, 05:12:32 pm by simply sibyl »

Offline mr_css

  • SMF For Free Sr. Member
  • *
  • Posts: 252
    • View Profile

  • Total Badges: 15
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: Swap Images on Page (Generator)
« Reply #1 on: October 20, 2007, 11:32:03 am »
Code: [Select]
<script type='text/javascript'>
/*
Change Any Image On Page
Created by iFusion
*/
var img_b = new Array();

img_b[img_b.length++] = [ "http://www.smfboards.com/Themes/default/images/on.gif" , "http://i216.photobucket.com/albums/cc283/mr_css/angry_homer_simpson.jpg" ]
img_b[img_b.length++] = [ "http://www.smfboards.com/Themes/default/images/off.gif" , "http://i216.photobucket.com/albums/cc283/mr_css/Simpsons-Yahoo-Avatars_100.jpg" ]

var all_images = document.getElementsByTagName('IMG');
for(i=0;i<all_images.length;i++){
for(j=0;j<img_b.length;j++){
   if(all_images[i].src == img_b[j][0]){
     all_images[i].src = img_b[j][1];
}}}
</script>

</body>

Mine will not work, Any help?

            WOLFSCAPE FORUMS

guest1608

  • Guest
Re: Swap Images on Page (Generator)
« Reply #2 on: November 24, 2007, 05:42:47 am »
The problem seems to be the </body> at the bottom of the code. Also, to change those images, got to your Admin CP>>Manage Styles>>Customize Images. You don't need a code for that.

Offline simply sibyl

  • Helpers
  • *
  • Posts: 14347
  • On hiatus
    • View Profile
    • The Tent Dwellers

  • Total Badges: 31
    Badges: (View All)
    Level 6 Poll Voter Webmaster Arcade Highscore Windows User
Re: Swap Images on Page (Generator)
« Reply #3 on: January 18, 2008, 06:59:55 pm »
Did webworldx stop hosting this code? Because it is no longer available.

I sent him an email.   Will wait to see

Offline simply sibyl

  • Helpers
  • *
  • Posts: 14347
  • On hiatus
    • View Profile
    • The Tent Dwellers

  • Total Badges: 31
    Badges: (View All)
    Level 6 Poll Voter Webmaster Arcade Highscore Windows User
Re: Swap Images on Page (Generator)
« Reply #4 on: January 18, 2008, 07:13:27 pm »
Gordie...  the code will still work.    The webpage was just an easy way to "make" the code.  You can do it yourself this way:

(The code goes in the Footer)

Code: [Select]
<script type='text/javascript'>
/*
Change Any Image On Page
Created by iFusion
*/
var img_b = new Array();

img_b[img_b.length++] = ["OLD IMAGE URL" , "NEW IMAGE URL"]

var all_images = document.getElementsByTagName('IMG');
for(i=0;i<all_images.length;i++){
for(j=0;j<img_b.length;j++){
   if(all_images[i].src == img_b[j][0]){
     all_images[i].src = img_b[j][1];
}}}
</script>


Replace OLD IMAGE URL with the url of the image you want to replace
Replace NEW IMAGE URL with the url of the new image you want to use

Add more of these lines if you have several images to swap:

img_b[img_b.length++] = ["OLD IMAGE URL" , "NEW IMAGE URL"]
« Last Edit: January 21, 2008, 10:37:30 am by simply sibyl »

Offline x-Treme

  • SMF For Free Hero
  • *
  • Posts: 592
  • formally known as Gordie!!!
    • View Profile
    • xTreme Arcade

  • Total Badges: 19
    Badges: (View All)
    Topic Starter Combination Level 4 Level 3 Level 2
Re: Swap Images on Page (Generator)
« Reply #5 on: January 18, 2008, 07:45:29 pm »
Thanks, Sibyl...I knew there was a way, just couldn't remember!

Offline simply sibyl

  • Helpers
  • *
  • Posts: 14347
  • On hiatus
    • View Profile
    • The Tent Dwellers

  • Total Badges: 31
    Badges: (View All)
    Level 6 Poll Voter Webmaster Arcade Highscore Windows User
Re: [Code] Swap Images on Page (Generator)
« Reply #6 on: January 29, 2008, 03:12:21 pm »
that site doesnt load it sez it doesnt exist can someone tell me another way to do this?

If you read the first post in this thread it says that the site is down and gives directions for how to do it manually.   

I have emailed and tried to reach the auther of the site to no avail.
You will need to do it manually, which is why that post is edited to reflect that.

Offline webworldx

  • Code Master's
  • *
  • Posts: 31
    • View Profile
    • InvisionFusion

  • Total Badges: 15
    Badges: (View All)
    Windows User Topic Starter Combination Level 3 Level 2
Re: [Code] Swap Images on Page
« Reply #7 on: January 31, 2008, 02:13:16 pm »

Offline simply sibyl

  • Helpers
  • *
  • Posts: 14347
  • On hiatus
    • View Profile
    • The Tent Dwellers

  • Total Badges: 31
    Badges: (View All)
    Level 6 Poll Voter Webmaster Arcade Highscore Windows User
Re: [Code] Swap Images on Page
« Reply #8 on: January 31, 2008, 02:15:46 pm »
New Host: http://www.ifcode.com/javascript/ImageSwapSMF.html

:)

Added it back to the first post.

Thanks!!!   Been looking around for you.   
I managed to find it thru Google cache but will leave your link here unless you'ld like it put on another site.
« Last Edit: January 31, 2008, 05:07:03 pm by simply sibyl »

Offline .:: £ SNIPER12903 £ ::.

  • SMF For Free Member
  • *
  • Posts: 71
    • View Profile

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
i think im quiting these forums? ull prbly see me on but like i wont post or say anything

Offline Josh[y]

  • SMF For Free Sr. Member
  • *
  • Posts: 478
  • <Insert whitty tagline here.>
    • View Profile

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Swap Images on Page
« Reply #10 on: October 15, 2008, 07:14:15 pm »
I used this code and it only swaps the images on the Customize Images page. I wanted to swap my online and offline images.

Offline simply sibyl

  • Helpers
  • *
  • Posts: 14347
  • On hiatus
    • View Profile
    • The Tent Dwellers

  • Total Badges: 31
    Badges: (View All)
    Level 6 Poll Voter Webmaster Arcade Highscore Windows User
Re: [Code] Swap Images on Page
« Reply #11 on: October 15, 2008, 07:16:00 pm »
I used this code and it only swaps the images on the Customize Images page. I wanted to swap my online and offline images.

We need to see the code you used and know what you were trying to swap in order to help you.

Offline Josh[y]

  • SMF For Free Sr. Member
  • *
  • Posts: 478
  • <Insert whitty tagline here.>
    • View Profile

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Swap Images on Page
« Reply #12 on: October 15, 2008, 09:45:38 pm »
Here is the code I used. I am trying to swap my online offline images.

Code: [Select]
<script type='text/javascript'>
/*
Change Any Image On Page
Created by iFusion
*/
var img_b = new Array();

img_b[img_b.length++] = [ "http://www.smfboards.com/Themes2/default/images/buddy_useroff.gif" , "http://www.styleyourforum.com/data/113/buddy_useroff.gif" ]
img_b[img_b.length++] = [ "http://www.smfboards.com/Themes2/default/images/buddy_useron.gif" , "http://www.styleyourforum.com/data/113/buddy_useron.gif" ]
img_b[img_b.length++] = [ "http://www.smfboards.com/Themes2/default/images/useroff.gif" , "http://www.styleyourforum.com/data/113/useroff.gif" ]
img_b[img_b.length++] = [ "http://www.smfboards.com/Themes2/default/images/useron.gif" , "http://www.styleyourforum.com/data/113/useron.gif" ]

var all_images = document.getElementsByTagName('IMG');
for(i=0;i<all_images.length;i++){
for(j=0;j<img_b.length;j++){
   if(all_images[i].src == img_b[j][0]){
     all_images[i].src = img_b[j][1];
}}}
</script>

Offline simply sibyl

  • Helpers
  • *
  • Posts: 14347
  • On hiatus
    • View Profile
    • The Tent Dwellers

  • Total Badges: 31
    Badges: (View All)
    Level 6 Poll Voter Webmaster Arcade Highscore Windows User
Re: [Code] Swap Images on Page
« Reply #13 on: October 15, 2008, 09:50:04 pm »
Change the "www" in the forum images to "images"

for instance the ones that start with:   http://www.smfboards.com
change them so they start with:  http://images.smfboards.com

Offline Josh[y]

  • SMF For Free Sr. Member
  • *
  • Posts: 478
  • <Insert whitty tagline here.>
    • View Profile

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [Code] Swap Images on Page
« Reply #14 on: October 15, 2008, 10:01:25 pm »
It worked! Thanks a ton sibyl! You rock!  :smitten:

 

Related Topics

  Subject / Started by Replies Last post
58 Replies
17596 Views
Last post November 04, 2006, 08:37:54 pm
by Adds
9 Replies
3244 Views
Last post January 19, 2009, 11:38:45 am
by simply sibyl
1 Replies
1508 Views
Last post March 14, 2009, 11:27:21 pm
by Agent Moose
1 Replies
814 Views
Last post March 10, 2010, 04:17:51 pm
by InsertName