The eAuction Support Forums
https://www.everyscript.de/cgi-bin/yabb/YaBB.pl
eAuction 1.6.1.x >> Unsorted >> thumbnail images not being written to file
https://www.everyscript.de/cgi-bin/yabb/YaBB.pl?num=1171072572

Message started by patnovack on 02/10/07 at 02:56:12

Title: thumbnail images not being written to file
Post by patnovack on 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 www.bidderssite.net 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 - www.bidderssite.net
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'} = 'http://www.bidderssite.net/images/uploaddir';
$config{'scripturl'} = 'http://www.bidderssite.net';
$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....

Title: Re: thumbnail images not being written to file
Post by Dieter Werner on 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.



Title: Re: thumbnail images not being written to file
Post by patnovack on 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.

Title: Re: thumbnail images not being written to file
Post by Dieter Werner on 02/11/07 at 23:28:23


patnovack wrote:
I have paid programers to build some custom stuff.

Why your paid programmers can't help you?  ;)


patnovack wrote:
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.

Yes, there is way ...
I'm involved in coding a program (better: module) that does things like this.

Title: Re: thumbnail images not being written to file
Post by patnovack on 02/12/07 at 02:21:59

Q: Why your paid programmers can't help you?
A: Perhaps I worded it wrong. I found some help through what you might call contract work. I posted a job I wanted done at scriptlance or hotscripts explaining what I wanted done and others would bid a price to have it done. Of the 3 times I did that, only one time did I recieve useful results. In another case it was a company that I paid them to install thier software to work with my flat file database.

Dieter said: Yes, there is way ... I'm involved in coding a program (better: module) that does things like this.

Reply: Wow, now that alone would be something that has my attentions. Please make sure to keep me abreast of your progress on that. Perhaps we would be interested in contracting with you to implement such features to our site. If we did have you actually do any work for us, you would get paid. Cause a confidential agreement is required by the company. I dont make those types of decisions on my own though. But will surely bring it up with the others this week. We actually are a company here, we do this for our living here in Metro Detroit Area and are quite popular within our reachable audience. We have two 30 sec. tv spots that run on local late night tv here 1220 times a month and run 34 websites. Its actually Sunday here, and the only reason you have me chatting today is cause Im installing our brand new Cisco PIX 501 External Hardware Firewall appliance to the server.

Title: Re: thumbnail images not being written to file
Post by Dieter Werner on 02/13/07 at 00:33:47

I will keep you informed ...

Title: Re: thumbnail images not being written to file
Post by Dieter Werner on 02/16/07 at 16:25:33

The module (I called it: AccessControl) is coded now and the first test drives have been done successfully.

Build in functions are
- check for extremely frequent access
- check for unwanted IP's
- check for unwanted IP ranges
- check for unwanted referrers
- check for unwanted user agents
- display a real captcha (not an image)

I'm going to test it more intensively and I'm going to optimize the code.

The eAuction Support Forums » Powered by YaBB 2.2!
YaBB © 2000-2007. All Rights Reserved.