Can I Customize Images on a Website?

  • Thread starter mattmns
  • Start date
  • Tags
    Websites
In summary, el-half gave what I think would be the easiest way. However still seems like a pain for little gain. Our graphics aren't that bad are they? Hmm looks like a pain I guess.
  • #1
mattmns
1,128
6
Is it possible to replace, let's say, some of the physicsforums icons with my own? Maybe have pf look at cache first, and then replace the images with my own?

I guess I know it is possible, just is it easy to do? Danke.
 
Computer science news on Phys.org
  • #2
Phew! are you sure You want to do it! I mean.. PF is not going to give u access for that!
 
  • #3
Well, you could like redirect all requests to https://www.physicsforums.com/images/ to 127.0.0.1 (localhost), by editing the hosts file, set up a webserver on your own computer, download all images from PF and replace whatever ones you want to replace. More like a waste of cpu and memory if you ask me.
 
Last edited by a moderator:
  • #4
mattmns said:
Is it possible to replace, let's say, some of the physicsforums icons with my own? Maybe have pf look at cache first, and then replace the images with my own?

I guess I know it is possible, just is it easy to do? Danke.

el-half gave what I think would be the easiest way. However still seems like a pain for little gain. Our graphics aren't that bad are they? :tongue2:
 
Last edited:
  • #5
Hmm looks like a pain I guess.

The graphics are not bad, I have gotten used to them, but I of course would like to be able to change them, or anything, to how I want it to look.

edit...
One of the ways I was thinking was to have the website code downloaded, then edit all instances, of say http://www.website.com/images/image.gif to file:///home/matt/images/image.gif
 
Last edited by a moderator:
  • #6
I think you can change websites with firefox.
 
  • #7
I was thinking about that too. But I only know how to remove objects with firefox, not change or add, going to do a quick search and see what comes up. Do you have any more info about that?
 
  • #8
I know there is a firefox extension that does this. I read about it not too long ago. I'll have to look it up.

[edit] I found it!

http://greasemonkey.mozdev.org/
 
Last edited:
  • #9
Thanks dduardo, checking it right now :smile:

edit... Wow! That extension is awesome! I have not changed any images on sites yet, but they have some really cool, and useful, scripts!
 
Last edited:
  • #10
Ok I can change images, but I only know how to change ones that have an id. How do I select an image that just has a source?

I used this to change images with an id, but many sites do not have ids for their images, any ideas?

Code:
(function() { 
document.getElementById('ID of image').src="location of image"
})();
 
  • #11
Your making it more difficult than it has to be. You can do something like this:

Code:
ChangeReplyButtons() {
for (var i=0; i < document.images.length; i++) {
if(document.images[i].src=="images/buttons/reply.gif") {
document.images[i].src="/home/david/myreply.gif" ;
}}}

You can add more if statements to change all the buttons. Isn't Javascript/DOM nice. I suggest you use the DOM inspector that comes with Firefox to help you.
 
Last edited:
  • #12
Thanks. I have the dom inspector installed, I guess the next step is to learn how to use it :smile:

Also, I am assuming from your response that I do not have to enter "file:///" before "home."
 
  • #13
You may or may not have to put file:///blah/blah/blah. When I type /home/dduardo into the browser it automatically resolves to file:///home/dduardo. Try it and see. Also remember that I'm on a linux system so on windows I don't know how this would work.
 
  • #14
Well I am on linux too :smile:

It does not when I enter a specific location of an image that has dashes in the name, it may be something else.

edit... and it does not seem to be working :yuck:

This is mines.user.js
Code:
ChangeMinesweeperPics() {
for (var i=0; i < document.images.length; i++) {
if(document.images[i].src=="file:///home/matt/minesweeper-beg-5.png") {
document.images[i].src="file:///home/matt/minesweeper-int-33.png" ;
}}}

This is minetest.html
Code:
<html>
<title>testing</title>
<head>
</head>
<body>
<img src="file:///home/matt/minesweeper-beg-5.png" />
</body>
 
Last edited:
  • #15
It may be me, not even my yahoo script is working now :mad:
 
  • #16
I just created a simple script that replaces an image and it works just fine. Here is my code:

test.user.js
Code:
for (var i=0; i < document.images.length; i++) {
if(document.images[i].src=="file:///home/dduardo/flowchart.bmp") {
document.images[i].src="sales_tax.png" ;
}}

test.html
Code:
<html>
<body>
<img src="flowchart.bmp">
<img src="sales_tax.png">
</body>
</html>

[edit]Actually, I just realized why your script doesn't work. Your just declaring the function but not actually running it. :rofl: :rofl:
 
  • #17
ROFL. You were right, it works now. Thanks
 
  • #18
Yay!

It officially works on pf.

http://img172.exs.cx/img172/2250/pfscreenshot4mj.png

Now to add some real images :smile:

Thanks!
 
  • #19
Ok I am beginning to think that this will not work. I am only able to replace the images with other images on the pf website.
 
  • #20
Are you sure?
 
  • #21
I am never sure :smile: But I have not been able to get it to work with images from other websites, or images from my computer.
 
  • #22
I found the problem:

For security reasons, Mozilla does not allow web content to link to local files. An error like:Security Error: Content at url may not load or link to file:///something will appear in the javascript console. If you need to follow links to local paths it is recommended that you drag the link to the location bar and then drop it on the webpage. If you really don't like the security check and are willing to risk all files on your system and that your system can access then you may add the following line to user.js in your personal profile directory. user_pref("security.checkloaduri", false); (Bug 84128)

You can change the image with one on the net.
 

Attachments

  • test.png
    test.png
    2.9 KB · Views: 359
Last edited:
  • #23
You could also use PF's RSS feed, along with a webserver, to generate pages that look like anything in the world, but contain content from PF.

- Warren
 
  • #24
Huh, why I be darned, there is an RSS feed. The button is so small you wouldn't even know it was there.

If you wanted to go down this route you could write a really simple python script that uses libxml2 and libxslt to generate a xhtml file based on the xml file you get from this site and your own xsl (xml stylesheet) file. Of course you'll need a running apache server.

[edit] Actually it looks like the RSS feed is broken. Firefox is complaining that it isn't vaild xml.
 
Last edited:
  • #25
Yeah it seems like RSS is temporarily broken. I've told Greg about it -- I don't know what the deal might be. We'll get it back up soon.

I personally think using the RSS/XML feed is the simplest and best way to do it.

- Warren
 
  • #26
Looks like one of the thread titles is breaking the RSS feed. I will investigate.
 
  • #27
Boy o boy!
i never knew that was possible. Nice anyways. but i haven't got how actually the dyanmically changing webpage be kept modified.
 

1. Why should I learn how to change websites myself?

Learning how to change websites yourself gives you more control over your website and allows you to make quick updates without having to rely on a web developer. It also saves time and money in the long run.

2. What skills do I need to learn in order to change websites myself?

It's helpful to have a basic understanding of HTML, CSS, and JavaScript in order to make changes to a website. You may also need to learn how to use a content management system (CMS) or website builder platform.

3. Can I make changes to any website?

If you have access to the backend of a website, either through a CMS or website builder platform, then you should be able to make changes. However, if the website is built with a custom codebase, you may need more advanced coding skills to make changes.

4. How often should I update my website?

It's important to regularly update your website to keep it relevant and functioning properly. This could mean making small updates every few weeks or larger updates every few months. It ultimately depends on your website's goals and needs.

5. Are there any risks to changing websites yourself?

If you are not familiar with coding or website management, there is a risk of making mistakes that could potentially break your website. It's important to back up your website before making any changes and to proceed with caution when making updates.

Similar threads

  • Computing and Technology
2
Replies
35
Views
3K
  • Computing and Technology
Replies
30
Views
2K
Replies
7
Views
688
Replies
10
Views
1K
  • Computing and Technology
Replies
11
Views
1K
Replies
16
Views
2K
  • Computing and Technology
Replies
1
Views
783
  • Computing and Technology
Replies
7
Views
1K
  • Computing and Technology
Replies
30
Views
2K
Replies
1
Views
732
Back
Top