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!
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.
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.
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 ||="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.
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" />
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" />
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.
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" />
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" />
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?
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" />
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";
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.
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.
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
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.
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" />
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" />
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.
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" /> !