Previous Thread
Next Thread
Print Thread
Hop To
Anonymous
Unregistered
Anonymous
Unregistered
Many of our users have no server to put their User Picture on. I'd like to let them upload it to *our* server from their Edit Profile Screen. I don't usually allow uploads but in this case it would be useful - if I could moderate it. I thought I'd be able to achieve what I want by setting up a board just for uploading User Pictures but I've discovered uploading files is a global setting and I don't want them to be able to do it from the other boards!

Anonymous
Unregistered
Anonymous
Unregistered
I was thinking the same thing. A lot of my users also won't have a stinkin clue what it means to make their picture 65x75 pixels either. I'll sound like that Bill Cosby routine about Noah to them... "Hey God! What's a cubit?" They don't know from pixels.

I'd like to allow them to upload an image, and I'd like to be informed when they do so that I can edit it if necessary.

I just finished working on an upload modification for Gossamer Threads Links... the mod is taken from the work of Alex Krohn who in turn took it from Rick from an old version of W3T. <img border="0" title="" alt="[Smile]" src="images/icons/smile.gif" /> At least I've got an idea how it works now. I'm going to see if I can put something together with that to allow this image upload thingy. I'll probably screw up because I'm a PERL moron, and I know nothing whatsoever about mySQL... but I'll give it a whack.

Phoenix

Anonymous
Unregistered
Anonymous
Unregistered
Just a tip, try not to store the images in mysql, it seems to load them extremely slowly. The best way I found is to have the images upload into a directory on your web server and just have the url to the different images stored mysql.

P.S. This could just be because I don't have the most recent version of mysql. I've got mysql-3.21.33c, which is now quite outdated.


------
Assassin
http://www.aus3d.net

Anonymous
Unregistered
Anonymous
Unregistered
Gee, I actually did this. (watch, it won't work for anyone else) <img border="0" title="" alt="[Wink]" src="images/icons/wink.gif" />

This will give the user the option of either linking to a picture or uploading one. The file will given the username of the person who uploaded it (if the username has a space, it will be replaced with an underscore). I've got it set up to only allow GIF and JPEG files for upload, but if you want to change that, you should see how in the code. I didn't get round to trying to get it to email the admin when an image is uploaded. I don't know if anyone wants that besides me anyway.

Most of the changes are in changebasic.pl, which I'm attaching here as a text file. My changes are marked clearly, and you'll find 3 places to edit: the maximum allowed file size, and the path and URL to where you want the pics stored. Just make sure the directory exists. <img border="0" title="" alt="[Smile]" src="images/icons/smile.gif" />

You'll need to make a few small changes in editbasic.pl too:
Find the <form> tag and add enctype='multipart/form-data' to it.

Get rid of the line: $Picture &#0124;&#0124;="http://";

Take the whole section that begins if ($config{'PictureView'} eq "on") and make that the LAST form-field in the form... you are putting it below "accept private messages" and "Visible in Who's Online" --- (this is the part that gave me headaches for 2 hours... some ridiculous offest in multipart forms, which w3t.pm corrects, but only if the upload field is the very last one)

Below the form-field for $Picture (which is now the last one) add a form field like this:
print "Upload your picture
";
print "<input type=FILE name=attach accept=\"*\">";

You'll probably want to edit the text for this section, telling the user that they can choose to either upload a picture or link to one on their server... not both. The URL of the uploaded file will end up in the Picture field after the upload.

I think that's it. Hope this is clear.
Phoenix

Anonymous
Unregistered
Anonymous
Unregistered
One small question to "Eileen of Wopr" and all kinds of work is being done.
Thanks to ALL of you that are working this. This is what makes visting these different forums fun and interesting.


DCA
184 days til <font color=red>retirement</font color=red> <img border="0" title="" alt="[Smile]" src="images/icons/smile.gif" />
but whose <font color=orange>counting</font color=orange> <img border="0" title="" alt="[Wink]" src="images/icons/wink.gif" />

Anonymous
Unregistered
Anonymous
Unregistered
Bingo. Give that Lady a Coconut!!!
Fantastic. It's exactly what I wanted and works like a charm.
Thanks, Phoenix.

Anonymous
Unregistered
Anonymous
Unregistered
Hehe. Gimme a few minutes to copy it over from my testbed and we'll all be able to see your smiling face in the WOPR Lounge.

Anonymous
Unregistered
Anonymous
Unregistered
Thanks for the NEW service, BUT, now I have to make a file just for you ( Eileen). This is going to take some time, I have to find a photo I can (WANT) to scan and prep for you.

Thanks

DCA
184 days til <font color=red>retirement</font color=red> <img border="0" title="" alt="[Smile]" src="images/icons/smile.gif" />
but whose <font color=orange>counting</font color=orange> <img border="0" title="" alt="[Wink]" src="images/icons/wink.gif" />

Anonymous
Unregistered
Anonymous
Unregistered
Excellent! Hehe... I'm so tickled when I do something in PERL and it actually works. <img border="0" title="" alt="[Cool]" src="images/icons/cool.gif" />

Now I just have to see if I can work out that emailing the admin part, because if I know my users, I'll have people uploading pictures with proportions that are nothing like 65x75 pixels. A lot of computer-newbies on my site.

Phoenix

Anonymous
Unregistered
Anonymous
Unregistered
Eileen's host did accept my post of my photo and it works. Great to get this service from a nice bunch of web nuts. And the picture is really me, some years ago.

Thanks,

DCA
184 days til <font color=red>retirement</font color=red> <img border="0" title="" alt="[Smile]" src="images/icons/smile.gif" />
but whose <font color=orange>counting</font color=orange> <img border="0" title="" alt="[Wink]" src="images/icons/wink.gif" />

Anonymous
Unregistered
Anonymous
Unregistered
OK, Dave, I'm going take a look.
Some years ago, eh? Boy, if you uploaded your baby picture, I'm calling a foul! <img border="0" title="" alt="[Wink]" src="images/icons/wink.gif" />

Phoenix

Anonymous
Unregistered
Anonymous
Unregistered
Dave raised a point privately:
Now that he's got his picture sitting on our server, can he link to it from other places - such as here? If we didn't want that to be possible is there a way to prevent it?

Anonymous
Unregistered
Anonymous
Unregistered
As a sample this photo is linked to Eileen's (WOPR) server. The address was obtained on line. If one knows much about surfing, this info is there tobe found.
To block this function may be a real task.
All I did was ask a simple question about a service, and opened a bucket of worms for "you" and your service providers.

Thanks,

DCA
184 days til <font color=red>retirement</font color=red> <img border="0" title="" alt="[Smile]" src="images/icons/smile.gif" />
but whose <font color=orange>counting</font color=orange> <img border="0" title="" alt="[Wink]" src="images/icons/wink.gif" />

Anonymous
Unregistered
Anonymous
Unregistered
This seems to work. Add it right at the end just before you send them to the confirm page.

<pre># -----------------------------------------
# Notify the Admin if they upload a userpic
if ($FORM{'FILE_CONTENT'}) {
# Get the Administrator's email address
require Mailer;
my $Admin = "Administrator";
my $Admin_q = $dbh -> quote($Admin);

$query = qq!
SELECT Email
FROM Users
WHERE Status = $Admin_q
!;
$sth = $dbh -> prepare ($query) or die "Query syntax error: $DBI::errstr. Query: $query";
$sth -> execute() or die "Can't execute query: $query. Reason: $DBI::errstr";
my ($Adminemail) = $sth -> fetchrow_array;

my $mailer = new Mailer ( { smtp => $config{'SMTP'}, sendmail => $config{'sendmail'} } ) or die "Can't init: $Mailer::error";
my $to = $Adminemail;
my $from = $config{'emailaddy'};
my $subject = "Userpic Upload";
my $msg = "'$Username' just uploaded a userpic.";
$mailer -> send( {to => $to, from => $from, subject => $subject, msg => $msg} ) or die "Can't mail message: $Mailer::error";

$sth -> finish;
}
</pre>

Anonymous
Unregistered
Anonymous
Unregistered
Thanks, Eileen! That's great!

Phoenix

Anonymous
Unregistered
Anonymous
Unregistered
Yep, it's certainly possible, as you've proved... but the thing is, the same is true of every picture or every document placed on the net. Basically if you make a thing publicly accessible from one location, you make it publicly accessible from any loacation. A link is just a link. There is a minor risk of "bandwidth theft" and there are ways around that... but for our purposes here, it's really not that big a worry.

The pics are very small. They aren't much use to anyone. The only person who might go around linking to a users picture from your site is the user themself. In your server logs you can see if this is happening, and the penalty for it is to remove that user's picture. I don't see any real hazard here.

Phoenix

Anonymous
Unregistered
Anonymous
Unregistered
Actually there is a way to prevent this.

You can serve the images -- or any kind of document for that matter -- through a script (ie. www.wwwthreads.org/perl/foo.pl?image=bar.gif). The script checks the HTTP_REFERER and if it's not from the local server, nothing gets outputed. If the HTTP_REFERER is ok, the content of that document (the full path to the file is not available to the outside world for obvious reasons) is served along with a correct "Content-type" directive. This is very easy to do, the only drawback being the speed penalty that comes with extra perl processes required.

Anonymous
Unregistered
Anonymous
Unregistered
Phonix,
Let's see what the "REAL" you look's like.

DCA
182 days til <font color=red>retirement</font color=red> <img border="0" title="" alt="[Smile]" src="images/icons/smile.gif" />
but whose <font color=orange>counting</font color=orange> <img border="0" title="" alt="[Wink]" src="images/icons/wink.gif" />

Anonymous
Unregistered
Anonymous
Unregistered
Oh, that's me. It's actually the most recent shot I have... about 6 months ago. Of course I don't normally wear quite that much make-up. <img border="0" title="" alt="[Smile]" src="images/icons/smile.gif" /> But just to be fair, here's the next most recent one I can find. Around 2 years ago, I guess. As with most pics of me, it's overexposed, making me look even paler than I am.
Phoenix

Anonymous
Unregistered
Anonymous
Unregistered
Hi,

the best way would be if the script would check the size of the picture automatic and just allow pics which fit in 65x75 to be uploaded...

i`ve seen something like this in the ultraboard 2000, but as this board is not released jet and i don´t have any clue about pearl i can´t say you how he has done it.

greetz,
Barlmoro

<A HREF="http://www.HaloZone.de/" target="_new">http://www.HaloZone.de/</A> (under development)
<A HREF="http://www.JaggedAlliance2.de/" target="_new">http://www.JaggedAlliance2.de/</A>

Anonymous
Unregistered
Anonymous
Unregistered
I've found there is no need to do that (as long as you limit the filesize) because it get displayed in the restricted 65x75 area anyway and if it looks horrible they soon re-upload one that fits! <img border="0" title="" alt="[Wink]" src="images/icons/wink.gif" />

<img src="http://www.amdragon.com/images/eileensig.gif" alt=" - " />

Anonymous
Unregistered
Anonymous
Unregistered
Agreed! I think it's okay to just limit the byte size, give them a little freedom! If it looks funny, it's up to them to decide what to do with it! <img border="0" title="" alt="[Wink]" src="images/icons/wink.gif" />

Anonymous
Unregistered
Anonymous
Unregistered
Actually, half the reason that I did this was because my board is not a techie board, and many of my users don't know a pixel from a hole in the ground. They don't know how to create their picture at a certain size, and maybe don't even have capable software. Of all the user pics that have been uploaded only 1 of them has managed to get the correct dimensions, although several have had the right aspect ratio. <img border="0" title="" alt="[Smile]" src="images/icons/smile.gif" /> and I even have a little white "sample image size" thingy for them to base it on.

So for a board like mine, limiting the upload to only files of the right dimensions would effectively prevent my users from uploading pics at all.

When they upload, I eventually get round to checking what they sent, and editing it for the proper size if necessary. It's a bit of a pain, but I can't think of any better way to do it. I can't give them all a lesson in computer graphics.

Phoenix

Anonymous
Unregistered
Anonymous
Unregistered
<blockquote><font size=1>In reply to:</font><hr>

I can't give them all a lesson in computer graphics.

[/quote]

*chuckling* right! <img border="0" title="" alt="[Smile]" src="images/icons/smile.gif" />

Anonymous
Unregistered
Anonymous
Unregistered
uploading picture in the profile, with any size and proportion. And, allow admins to delete the picture


and, remove picture automatically if profiles is deleted, or if a post is deleted.

Anonymous
Unregistered
Anonymous
Unregistered
True, that would be very helpful to delete the picture when a user gets deleted. Also, a way for moderators to delete it.

Anonymous
Unregistered
Anonymous
Unregistered
Hi Phoenix,

Can you please repost your TXT attachment? For some reason, the link is bringing me back to the WWWThreads homepage. Thanks <img border="0" title="" alt="[Smile]" src="images/icons/smile.gif" /> !

Anonymous
Unregistered
Anonymous
Unregistered
Here you go - just in case Phoenix isn't around.

<img src="http://www.amdragon.com/images/eileensig.gif" alt=" - " />

Anonymous
Unregistered
Anonymous
Unregistered
Thanks Eileen!!! <img border="0" title="" alt="[Wink]" src="images/icons/wink.gif" />

Anonymous
Unregistered
Anonymous
Unregistered
Will this work for all versions or just versions below 5.1?

Baalack

Baalack

Anonymous
Unregistered
Anonymous
Unregistered
This has been around for a long time. I have now been retired for over 11 months.

<font color=red>D</font color=red><font color=orange>a</font color=orange><font color=blue>v</font color=blue><font color=green>e</font color=green><font color=purple>A</font color=purple>

Anonymous
Unregistered
Anonymous
Unregistered
It'll need tweaking to bring it up to date but I had no trouble - it's working on 5.0.9 at Amdragon.

<img src="http://www.amdragon.com/images/eileensig.gif" alt=" - " />

Anonymous
Unregistered
Anonymous
Unregistered
So... 5.5 is still too soon for picture upload? <img border="0" title="" alt="[Frown]" src="images/icons/frown.gif" />

Mateo Byler
CruceDeCaminos.com


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
spam issues
by ECNet - 03/19/2024 11:45 PM
Who's Online Now
2 members (Nightcrawler, Ruben), 694 guests, and 214 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)