eAuction
  Not just another Perl script
Google
Welcome, Guest. Please Login or Register


If you use eAuction a lot and like it or if you make money from eAuction or from eAuction-related activities ...
then the project asks you for a donation in favor of the further development.



The forums are protected by
AccessControl
(written by Dieter Werner)
Click here if you want to check your IP against the most important RBLs of the net.
Click here in order to visite the AccessControl forums.


<< Visit the international e Auction Marketplace >>
Buy and sell PC and Consumer Electronic components






  HomeHelpSearchLoginRegister
 



Pages: 1 2 3 
thumbnail images not being written to file (Read 638 times)
patnovack
eAuction User
**
Offline

I Love Perl

Posts: 6

thumbnail images not being written to file
02/10/07 at 02:56:12
 
I am testing out a new server.

My main site is BiddersSite.com, but we have been testing all the different functions of the script on the .net domain, and manage to clear up the problems with your help and a lot of trial and error. We have it down to one last problem, which after days of attempts to get it to work right, we havent solved the problem. So as our last resort we have turned to you oh mighty script guru and hope that we could run it by you. It may be something very obvious to an expert, while I have overlooked it time and time again.

The file works, just not completly, its within cgi-bin/auctions/upload.cgi file where users upload there items pictures. The script is meant to upload up to four pictures, and make a thumbnail of the 1st one to be stored respectively to:

/images/uploaddir/
/images/uploaddir/thumbs/

The script does upload the photo to the uploaddir, however its not saving a thumbnail image as it should to sub directory /thumbs.

The script seems to run the same with or without the use carp: When I had it report to browser, it didnt display an error. All the same, its still not writing the image file for the thumbnail image. Ive double checked my permissions as well. Nothing seemed to make any difference.

In case you need to see it work, from the hompage Multimedia file viewing and clickable links are available for registered members only!!  You need to Login or Register!!
hit "sell" at the very top of the page, then select the third option - upload images at the bottom, this calls the upload.cgi, where you select a image file to upload, then preview the image, it shows you the image has been uploaded, then you would have to select gallery, featured, category featured, also it requires a catergory, begining price and username and password.  We have setup username=Tester4 and password=testing for you. We know your time is valuable, and we thank you for your efforts with us.

Domain in question - Multimedia file viewing and clickable links are available for registered members only!!  You need to Login or Register!!

This is the code of my upload.cgi file.

#!/usr/bin/perl

use CGI qw/:standard/;
$config{'currency'} = '$';
$config{'textuploadcharge'} = '0.00';
$config{'textuploadcharge2'} = '0.00';
$config{'textuploadcharge3'} = '0.15';
$config{'textuploadcharge4'} = '0.15';
$config{'sitename'} = 'bidderssite.net';
$config{'imageuploaddir'} = '/var/www/vhosts/bidderssite.net/httpdocs/images/uploaddir';
$config{'imageuploadurl'} = 'Multimedia file viewing and clickable links are available for registered members only!!  You need to Login or Register!!
';
$config{'scripturl'} = 'Multimedia file viewing and clickable links are available for registered members only!!  You need to Login or Register!!
';
$config{'closedays2'} = 90;
$config{'imagesize'} = 500;
$config{'colortablehead'} = '#E6E6E6';
$config{'bordercolor'} = '#0000FF';
$config{'bordercolor1'} = '#000000';
$config{'odd_row_color'} = '#FFFFFF';
$config{'even_row_color'} = '#EEEEEE';
$config{'header2'} =<<"EOF";

<HEAD>
<TITLE>$config{'sitename'}</TITLE>
</HEAD>
<FONT FACE=ARIAL><BODY TEXT=#000000 BGCOLOR=#FFFFFF LINK=#0000FF VLINK=#800080 ALINK=#FF0000>
<a href=/index.shtml><img border=0 src=/images/logo.gif></a><br><br><br><br>

EOF

@ext = qw(jpeg jpg gif bmp);
$| = 1;
$match = 0;
$encoding = 'multipart/form-data';
$q = new CGI;
print "Content-type: text/html\n\n";
print $config{'header2'};
print "<div align=center><center><table border=0 cellpadding=0 cellspacing=0 width=100% bordercolor=$config{'bordercolor'}>";
print "<tr><td width=100% bgcolor=$config{'colortablehead'} height=30><b>&nbsp;Select your picture(s) to upload (@ext - $config{'imagesize'} kb maximum)</b></td></tr></table></center></div><br>";
print $q->startform($method,$action,$encoding);
print "<center><font face=arial size=2><b>Upload Charge $config{'currency'}$config{'textuploadcharge'} - Image 1: </b></font>";
print $q->filefield(-name=>'upload_file1', -default=>'starting value', -size=>50, -maxlength=>180);
print "<br><font face=arial size=2><b>Upload Charge $config{'currency'}$config{'textuploadcharge2'} - Image 2: </b></font>";
print $q->filefield(-name=>'upload_file2', -default=>'starting value', -size=>50, -maxlength=>180);
print "<br><font face=arial size=2><b>Upload Charge $config{'currency'}$config{'textuploadcharge3'} - Image 3: </b></font>";
print $q->filefield(-name=>'upload_file3', -default=>'starting value', -size=>50, -maxlength=>180);
print "<br><font face=arial size=2><b>Upload Charge $config{'currency'}$config{'textuploadcharge4'} - Image 4: </b></font>";
print $q->filefield(-name=>'upload_file4', -default=>'starting value', -size=>50, -maxlength=>180);
print "<br>";
print $q->submit(-name=>'button_name', -value=>'Upload Image(s)');
print "</center>";
print $q->endform;
print "<hr width=80% size=1 color=$config{'bordercolor'}>";
print "<center><p><font face=arial size=2>Please click the \"Image Upload\" button only once,<br>Image Upload can take up to 5 seconds per image you upload.<br>Your images will appear below when finished.</font></center></p>";
print "<hr width=80% size=1 color=$config{'bordercolor'}>";
umask(000);  # UNIX file permission junk
mkdir("$config{'imageuploaddir'}", 0777) unless (-d "$config{'imageuploaddir'}");

$file1 = $form{'upload_file1'};
$file2 = $form{'upload_file2'};
$file3 = $form{'upload_file3'};
$file4 = $form{'upload_file4'};

$uploadfile1 = $q->param('upload_file1');
$uploadfile2 = $q->param('upload_file2');
$uploadfile3 = $q->param('upload_file3');
$uploadfile4 = $q->param('upload_file4');

     if ($ENV{'CONTENT_LENGTH'} >= $config{'imagesize'} * 1024) {    
             print "<p><div align=center><font face=arial size=2 color=FF0000><p>Error - The image file size is too large\!</font></p>\n";
             print "<p><font face=arial size=2>Sorry but your upload image size can not be over $config{'imagesize'}k.</font></p>\n";
             print "<p><font face=arial size=2>Please only upload images with a file size less than $config{'imagesize'}k.</font></p></div>";
             exit 0;
}

     if ($uploadfile1){
     $uploadfile1 =~ /\w:[\\[\w- ]*\\]*([\w- ]*.\w{1,3})$/g;
     $file1 = $1;
       foreach $ext (@ext){
               if (grep /$ext$/i,$uploadfile1){
               $match = 1;
               $type = $ext;                                
               }
               }
               if ($match){
           $newimage = ($config{'closedays2'} * 86400 + time);
           $file1 = "$newimage.$type";
           undef $bytesread;
           open(OUTFILE, ">$config{'imageuploaddir'}/$file1")||&error("Can not open $config{'imageuploaddir'}/$file1. $!");
           binmode OUTFILE;
           while ($bytesread=read($uploadfile1,$buffer,1024)) {
           print OUTFILE $buffer;
           }
           close (OUTFILE);
               sleep 2;  # Wait 2 seconds
               }
               else {
               &error("<center><font face=arial size=2><b>Image format not supported.</b><p>$uploadfile1</p><b>Upload has failed.</b></font></center>");
               }    
               }      

     if ($uploadfile2){
     $uploadfile2 =~ /\w:[\\[\w- ]*\\]*([\w- ]*.\w{1,3})$/g;
     $file2 = $1;
       foreach $ext (@ext){
               if (grep /$ext$/i,$uploadfile2){
               $match = 1;    
               $type=$ext;                            
               }
               }
               if ($match){
           $newimage = ($config{'closedays2'} * 86400 + time);
           $file2 = "$newimage.$type";
           undef $bytesread;
           open(OUTFILE, ">$config{'imageuploaddir'}/$file2")||&error("Can not open $config{'imageuploaddir'}/$file2. $!");
           binmode OUTFILE;
           while ($bytesread=read($uploadfile2,$buffer,1024)) {
           print OUTFILE $buffer;
           }
           close (OUTFILE);  
               sleep 2;  # Wait 2 seconds
               }
               else {
               &error("<center><font face=arial size=2><b>Image format not supported.</b><p>$uploadfile2</p><b>Upload has failed.</b></font></center>");
               }
               }

     if ($uploadfile3){
     $uploadfile3 =~ /\w:[\\[\w- ]*\\]*([\w- ]*.\w{1,3})$/g;
     $file3 = $1;


Theres more but I ran out of room....
Back to top
 
 


Advertising
View Profile   IP Logged
Dieter Werner
Administrator
*****
Offline

Dipl. Paranoiac ®

Posts: 1162
Germany
Gender: male
Re: thumbnail images not being written to file
Reply #1 - 02/10/07 at 14:21:20
 
Hi Patrick,

you use the very old code that has been written by Matt Hahnfeld.
The uploader (very old too) has been released by Stuart Jones and is just a (sloppen done) rewrite of a file uploader that I posted (years ago) to the EverySoft addon database.
So all of your problems are really not eAuction related.

But I will try to help you - if I can.
Send a zip file of your script via email and/or let me access your server via FTP.


Back to top
 
 

Multimedia file viewing and clickable links are available for registered members only!!  You need to Login or Register!!


Greetings from Germany
Dieter Werner




Advertising
View Profile | WWW   IP Logged
patnovack
eAuction User
**
Offline

I Love Perl

Posts: 6

Re: thumbnail images not being written to file
Reply #2 - 02/11/07 at 20:46:27
 
Thanks Dieter, you may not realize it, but you helped me out alot. I was so busy trying to make that old script work I hadnt thought about looking at other options. Once you informed me that it was a old script and not that good, I looked for something else. I got it working again by installing the latest ImageMagick.

It actually surprised me to learn it was a rewrite of a script you posted years ago. When I started this I knew nothing. I bought the beginnings of my site from another person on Ebay. I've learned alot over the last two years. And changed and evolved the site alot. My site is a mish-mash of many scripts and the like. I know there are parts and pieces from several auction programs, including global exchange technoligies management doctor script, account first, eauction, everyauction and two storefront scripts from sunnyscripts. As well as I have paid programers to build some custom stuff.

I have another question, not related to the above, I was wondering if there is anyway you are aware of to regulate of filter by country the visitors to a website? Something that would only allow USA and Canada IPs? Russians and Africans have long been a problem for me. I currently keep and update a htaccess file, continously adding blocks of IP#s when new unwanted visitors are detected.
Back to top
 
 


Advertising
View Profile   IP Logged
Pages: 1 2 3 


If you like eAuction, please Rate it.
If you don't like eAuction, please Rate it too.


1 is being poor and 10 is being excellent


EveryScript

ip-location


AccessControl - Members Only