Author |
Topic |
Todd
New Member
USA
63 Posts |
Posted - 15 February 2010 : 03:14:00
|
If this is the incorrect forum I apologize, I thought this was the best fit.
A big problem I have and probably everyone else is when forum members link to external images that disappear later on. Many topics now have red X's where the now non-existant images should have been.
I have proeders file attachment mod being used but still many members find it easier to just throw up a link to inkfrog or another image hosting company.
My idea is this. I would like an admin utility that will go through a forum at a time and detect all links to external images, all of the IMG tagged lines which are followed by http, indicative of an external image. I would like it to then get that image and place it in the users uploaded folder. The final step would be to change the line of code to point to the forum stored image.
This would be a god send for most of us. Thanks in advance. |
Admin for the Tyco Collector's Forum
|
Edited by - Todd on 21 February 2010 14:10:58 |
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 15 February 2010 : 12:41:21
|
are you able to use .net on your web server? I already have some code in .net that would do this with a little tinkerring, and is a lot easier to do in .net than classic ASP |
|
|
Todd
New Member
USA
63 Posts |
Posted - 15 February 2010 : 18:11:11
|
Thanks for the response. I'm not sure how to answer your question so I will tell you what I do and do not have.
The server is running Windows 2003 Server with SP2. The .Net Framework for versions 2, 3 and 3.5 are installed, all are at the latest service pack. I am using IIS and ASP.Net v2.0.50707 is installed.
I do not have any .net developer tools installed.
What do I need if anything? In short, to answer your question are you able to use .net on your web server? I will do whatever it takes to make this work.
Also to get another question out of the way, does your code do this for the entire forum at one shot or can I narrow it down to individual forums? I would then set up a test forum to test and troubleshoot it. I would be hesitant to try this out against 5 years worth of work. |
Admin for the Tyco Collector's Forum
|
Edited by - Todd on 15 February 2010 23:26:44 |
|
|
MaD2ko0l
Senior Member
United Kingdom
1053 Posts |
Posted - 15 February 2010 : 20:51:11
|
Hi,
i would be intreasted in this code you have HuwR, Sounds like it will come in handy with a gallery project im working on.
do you mind sharing it?
Thanks
MaD2ko0l |
© 1999-2010 MaD2ko0l |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 16 February 2010 : 13:01:02
|
Todd, all you need is the .net frameworks installed, I will try and throw something together over the weekend, bit pushed for time in the evenings at the moment, but hassle me after the weekend if you haven't heard anything.(I will make it work on individual forumsas it could take a while to do a whole Forum in one go)
maD2ko0l, sure no problem I will post the code next week, do you want the raw grab and save code or the finished code I will make for Todd ? |
|
|
Todd
New Member
USA
63 Posts |
Posted - 18 February 2010 : 00:45:10
|
Thank you so much HuwR!.. Whenever it's ready is fine, no rush. I will keep checking here. Do you need my contact information? |
Admin for the Tyco Collector's Forum
|
|
|
MaD2ko0l
Senior Member
United Kingdom
1053 Posts |
Posted - 18 February 2010 : 18:34:01
|
the raw grab and save code would be great if you dont mind.
thanks very much |
© 1999-2010 MaD2ko0l |
|
|
Todd
New Member
USA
63 Posts |
Posted - 18 February 2010 : 19:35:31
|
quote: Originally posted by MaD2ko0l
the raw grab and save code would be great if you dont mind.
thanks very much
Actually both would be great. Looking at the 2 I'm sure there's a lot I can learn.
|
Admin for the Tyco Collector's Forum
|
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 20 February 2010 : 03:28:48
|
quote: Originally posted by MaD2ko0l
the raw grab and save code would be great if you dont mind.
thanks very much
this is the grab and save code, and shows the simplicity of using .Net (code is C#)
Grabbing the image is simple, first we declare a byte array to store the image in Byte[] imagearray; next we grab the image into the array using the webclient class
using (WebClient client = new WebClient()) { imagearray = client.DownloadData(urlofimage); } next we just save the imagearray to disk using a filestream
using (FileStream writer = new FileStream(destinationpath + filename, FileMode.Create)) { writer.Write(image, 0, image.Length);
}
I will post the full code for parsing the img tags and grabbing the images later
|
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 20 February 2010 : 03:42:12
|
Todd, what database do you use ?
what would you like it to do if it fails to retreive the image ? |
|
|
Todd
New Member
USA
63 Posts |
Posted - 20 February 2010 : 22:51:55
|
quote: Originally posted by HuwR
Todd, what database do you use ?
what would you like it to do if it fails to retreive the image ?
I'm using an Access 2000 database.
If it were to fail to get the image I would imagine you are referring to when that particular image has already "diappeared" from it's externally hosted site. Maybe it would be good to replace that with a generic image called PleaseFixLink.jpg That could be an image that all snitz forum admins can decide they want it to be. Thinking about this more that would mean we would be changing the link to point to that generic image thus losing the original non working link.
Ideas?
Maybe just logging the poster name, forum/topic and missing image link? I could then PM the user's asking them to fix it. The next time I run the utility it could pick up the image.
|
Admin for the Tyco Collector's Forum
|
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 21 February 2010 : 02:53:35
|
quote: Maybe just logging the poster name, forum/topic and missing image link? I could then PM the user's asking them to fix it. The next time I run the utility it could pick up the image.
That may not help, in some of the tests I ran the image no longer existed because the domain had "diappeared", so it is likely that the user may no longer be contactable either |
|
|
Todd
New Member
USA
63 Posts |
Posted - 21 February 2010 : 12:09:09
|
quote: Originally posted by HuwR
quote: Maybe just logging the poster name, forum/topic and missing image link? I could then PM the user's asking them to fix it. The next time I run the utility it could pick up the image.
That may not help, in some of the tests I ran the image no longer existed because the domain had "diappeared", so it is likely that the user may no longer be contactable either
Yes that could be the case but... I know many of my users are still active on the forums and there is a good chance they would upload the pictures again if I asked them to. They would probably do it the "proper" way which would be using the file attachment mod. Right now there are just too many missing images and I have no efficient means of pinpointing all of them. I would say only 5% of the images aren't available for viewing for all of the reasons discussed but with thousands of posts... tough job for anyone. |
Admin for the Tyco Collector's Forum
|
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 21 February 2010 : 12:30:08
|
I have it almost ready. just doing some tests on it now, any images it can't pick up are logged to a file which you can load up when the transfer is finished, it will tell you why it couldn't grab it and provide a link to the post.
Do you want to be able to do this with archived posts as well ? |
|
|
Todd
New Member
USA
63 Posts |
Posted - 21 February 2010 : 12:43:12
|
quote: Originally posted by HuwR
I have it almost ready. just doing some tests on it now, any images it can't pick up are logged to a file which you can load up when the transfer is finished, it will tell you why it couldn't grab it and provide a link to the post.
Do you want to be able to do this with archived posts as well ?
Excellent, glad I'm online at the same time you are for once. As far as archived posts goes I have very few archived posts. The only posts I've archived are ones from me addressing the forum members with changes I've made. Some are no longer relevant so I archive them. That might however be useful for other forum admins.
Looking forward to trying this out, it's a good day for me to do it. |
Admin for the Tyco Collector's Forum
|
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 21 February 2010 : 13:00:25
|
I'm just adding some other checks to try and reduce the time it takes, say for example if it has already logged a url as missing there is no point in looking if it crops up again |
|
|
Topic |
|