Welcome to Geeklog, Anonymous Wednesday, December 07 2022 @ 12:21 pm EST

Geeklog Forums

upage v 2.0 released!

Page navigation


Status: offline

amckay

Forum User
Full Member
Registered: 03/23/02
Posts: 180
Quote by destr0yr:Warning: fopen on line 1100


Hmmm, the file isn't supposed to exist in most cases. This is where I check to see if the file is already there, and if it is you can upload over top of it. So you can update the file. I think this must be a PHP setting of yours. Can you put your phpinfo up somewhere for me to see? Create a file with

Text Formatted Code

<?php
phpinfo();
?>

 


And put it up on your website somewhere. Mine is at https://secure.neap.net/phpinfo.php

Text Formatted Code

Warning: Cannot use a scalar value as an array in /homepages/12/d88571136/htdocs/okg/plugins/upage/functions.inc on line 932

 


These are normal PHP statements as well. It has to have something with your PHP settings. Edit the file and change the single quotes on those two lines to double quotes out of curiousity. That shouldn't be it though. I honestly do not know what kind of problem it could have with this.

Text Formatted Code

 $ret['x']       = 0;
 $ret['y']       = 0;

 


Totally normal PHP.


the file is successfully saved, but its telling me that it doesnt exist, when in fact it does? i set perms to 777 just to test...


What is telling you it is not there? You mean it is not showing up in the list? That would mean no DB entry for it.


uhh... yah...
one last (nitpicky) thing, if images have spaces, it borks... maybe something that removes the spaces and renames the file?


Doh! Will do. You can add it yourself in the meantime. Look for the function UPIC_Upload() around line 1066, and insert this right after the 'global' declarations at the top of the function :

Text Formatted Code

$P['fclient'] = UPAGE_strip( $P['fclient'] );

 


cheers,
-Alan
 Quote

Status: offline

amckay

Forum User
Full Member
Registered: 03/23/02
Posts: 180
Gah - OK, I think I see the problem with the 'scalar value' thing. Doh! I'll have a fix in a few minutes.
 Quote

Status: offline

amckay

Forum User
Full Member
Registered: 03/23/02
Posts: 180
Actually, just delete the two lines in question! They were left over from a different way I was trying to write that function.

these two :
Text Formatted Code

$ret['x']       = 0;
$ret['y']       = 0;

 


 Quote

Status: offline

TechSys

Forum User
Regular Poster
Registered: 12/02/03
Posts: 90
I finally got it installed. It was actually painless after getting the new Aeonserv package installed. I do have one little problem though... so far.
I tried to upload a .jpg file and got the Following
[25.jpg] ...
... Successful file upload
File is not of specified type

From the looks of it, it doesn't allow .jpg files? I havent tried other pics yet, but will soon.
http://70.145.174.180/
 Quote

Status: offline

amckay

Forum User
Full Member
Registered: 03/23/02
Posts: 180
It definitely allows JPG files. This is the first check that I have NetPBM doing, so it will have something to do with your NetPBM version or your path to NetPBM.

Basically all it is trying to do is execute the command "jpegtopnm" on your file. If it cannot do this for whatever reason, or if that command returns an error message, it will report this.

Now, I'm using UNIX type return codes here as well, and maybe that's the problem. In UNIX if the command returns 0, then it was successful. Any other return code is a problem. Do Windoze commands even return return codes?

In functions.inc it is the 'UPIC_checkFormat' function.

Text Formatted Code

function UPICL_checkFormat( $fname, $ftype )
//
// check to see if the file is of the type
// claimed to be during upload
// requires NetPBM
//
{
        global  $_CONF;

        if ( empty( $_CONF['upic_pbm'] ) )
                return 0;

        $tfile  = $_CONF['upic_tmpdir'] . "upic." .  COM_makesid();

        $comm   = $_CONF['upic_pbm'] . $ftype . "topnm " . $fname
                . " > $tfile";

        $output = system( $comm, $ret );

        unlink( $tfile );

        if ( $ret == 0 )
                return 1;
        else
                return 0;
}


 


If you want to disable this check, just change the function to always return 1. But I'd like to get to the bottom of this because I suspect it is another UNIX/Windows thing.
 Quote

FreakWorld

Anonymous
So how is this plug coming?
And is the links still working to it?
 Quote

Status: offline

destr0yr

Forum User
Full Member
Registered: 07/06/02
Posts: 324
Hey Allen... I'm still having some troubles with this... getting the following errors on uploading

Text Formatted Code
<br />Warning: fopen(/home/okanagan/public_html/upage/upic/2/biglan.jpg): failed to open stream: No such file or directory in /home/okanagan/plugins/upage/functions.inc on line 1124<br /><br />Warning: Division by zero in /home/okanagan/plugins/upage/functions.inc on line 1177<br />An SQL error has occured. Please see error.log for details.<br /><br />


err.. and in error.log, it has:
Text Formatted Code
<br />Sat Feb 28 11:09:15 2004 - 1064: You have an error in your SQL syntax.  <br />Check the manual that corresponds to your MySQL server version for the right syntax to use near '  ,  0,  0,  0,  "")' at line 1. SQL in question: INSERT INTO gl_upic  (upic_id,upic_uid,upic_uploaded,upic_date,upic_file,upic_type,upic_x,upic_y,upic_thumb,upic_small,upic_screen,upic_caption)  VALUES ( 0,  2,  "2004-02-28 11:09:15",  "2004-02-28 11:09:15",  "biglan.jpg",  "jpeg",  ,  ,  0,  0,  0,  "")<br /><br />

-- destr0yr
"I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams
 Quote

Status: offline

amckay

Forum User
Full Member
Registered: 03/23/02
Posts: 180
Sorry haven't been checking back here in a while. You can always email me too. Looks like pbm is not returning the same values as on my system. You have PBM installed, right?

You're on Windows, right?
What do you have _CONF['upic_usepipes'] set to? Whatever you have it set to, try the opposite (0 or 1).

Manually run the pbm program "pamfile" on a file from the command line, and tell me what the output is. You'll have to first use another of the pbm commands to convert the file to pam. e.g. 'jpgtopnm' or 'giftopnm'. Then run 'pamfile' on the new image created by the first program.
 Quote

Status: offline

destr0yr

Forum User
Full Member
Registered: 07/06/02
Posts: 324
Quote by amckay:You have PBM installed, right?

NetPBM. The binaries for Gallery. (filename: netpbm1.1-gallery1.0-linux2.2-redhat6.2-intel.tgz)
You're on Windows, right?

How dare you insult me like that Wink Heh, no, my host uses Linux.
What do you have _CONF['upic_usepipes'] set to? Whatever you have it set to, try the opposite (0 or 1).

Tried, it was 1, changed to 0, same error.
Manually run the pbm program "pamfile" on a file from the command line, and tell me what the output is. You'll have to first use another of the pbm commands to convert the file to pam. e.g. 'jpgtopnm' or 'giftopnm'. Then run 'pamfile' on the new image created by the first program.

`pamfile'? I do not have pamfile. My directory listing has the following files:
Text Formatted Code
README  giftopnm  jhead  jpegtopnm  pngtopnm  pnmcut  pnmfile  pnmflip  pnmrotate  pnmscale  pnmtopng  ppmquant  ppmtogif  ppmtojpeg

 

-- destr0yr
"I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams
 Quote

Status: offline

amckay

Forum User
Full Member
Registered: 03/23/02
Posts: 180
I'll check to see if your 'pnmfile' does the same thing as pamfile. My distro has both. I suspect it does do the same, in which case I'll show you how to make the change, and add it to configuration for the next release.
 Quote

Status: offline

amckay

Forum User
Full Member
Registered: 03/23/02
Posts: 180
Looks like they are the same :

heimat# jpegtopnm pump1.jpg | pamfile
jpegtopnm: WRITING PPM FILE
stdin: PPM raw, 1024 by 768 maxval 255
You have new mail.
heimat# jpegtopnm pump1.jpg | pnmfile
jpegtopnm: WRITING PPM FILE
stdin: PPM raw, 1024 by 768 maxval 255


So right around 1177 where the error was reported, look for "pamfile" and replace it with "pnmfile" and you should be good to go.

Or wait, no. Just about 1177 is where UPIC_imageInfo is called. Look for the function UPIC_imageInfo (or depending which version you have, UPICL_imageInfo) around line 917 and change both occurances of "pamfile" in there to "pnmfile"
 Quote

Status: offline

destr0yr

Forum User
Full Member
Registered: 07/06/02
Posts: 324
Quote by amckay: I'll check to see if your 'pnmfile' does the same thing as pamfile. My distro has both. I suspect it does do the same, in which case I'll show you how to make the change, and add it to configuration for the next release.

Thank you. I appreciate your help and dedication in helping me resolve this issue. I patiently await your findings.
-- destr0yr
"I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams
 Quote

Status: offline

amckay

Forum User
Full Member
Registered: 03/23/02
Posts: 180
See above - they are the same and the above should solve your problem.
 Quote

Status: offline

destr0yr

Forum User
Full Member
Registered: 07/06/02
Posts: 324
Quote by amckay: See above - they are the same and the above should solve your problem.
Great, thanks. That fixed that part.

Now, on uploading an image, I receive the following error in error.log:
Text Formatted Code
Tue Mar 16 14:49:50 2004 - 1064: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND uh_album = 0' at line 1. SQL in question: SELECT * FROM gl_upic_highlight  WHERE uh_uid =  AND uh_album = 0
 

which somewhat makes sense since gl_upic_highlight is empty...

-- destr0yr
"I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams
 Quote

Status: offline

amckay

Forum User
Full Member
Registered: 03/23/02
Posts: 180
Damn! Now that's a bug! Not sure why it hasn't popped up here yet ...

Around line 1353 in functions.inc you will see

Text Formatted Code

       // and now do the highlight

        $sql    = "SELECT * FROM {$_TABLES['upic_hl']} "
                . " WHERE uh_uid = " . $UP['upic_uid']
                . " AND uh_album = 0 ";




 


Change the upic_uid (2nd line of sql, right hand size of equals sign) to uh_uid

doh!

EDIT : wait a sec ... let me look at this more closely before doing anything as it looks like this is just a symptom, and not the problem.

ANOTHER EDIT : go to the line I note above and find the comment about 'now do highlight' and post what your code says. Basically, does your code snippet look like the one above? The one above should actually be correct because when I change it as I suggested above, that's when I actually get the error like yours. Exact same error.
 Quote

Status: offline

amckay

Forum User
Full Member
Registered: 03/23/02
Posts: 180
OK, it must mean the previous query failed and stupid me I don't do error checks. Just prior to the code mentioned above is :

Text Formatted Code

        // now we have to re-lookup the one we just inserted

        $sql    = "SELECT * FROM {$_TABLES['upic']} "
                . " WHERE upic_uid = {$P['upic_uid']} "
                . " AND upic_file = "{$P['fclient']}" "
                . "";
        $result = DB_query( $sql );
        $UP     = DB_fetchArray( $result );


 


Add a check on the DB_query so it looks like this :

Text Formatted Code

        // now we have to re-lookup the one we just inserted

        $sql    = "SELECT * FROM {$_TABLES['upic']} "
                . " WHERE upic_uid = {$P['upic_uid']} "
                . " AND upic_file = "{$P['fclient']}" "
                . "";

        if ( ! $result = DB_query( $sql ) ) {
                $retr   .= " ... " . $LANG_UPAGE['upic_db_fail']
                        . " [" . $sql . "]";
                return $retr;
        }

        $UP     = DB_fetchArray( $result );



 
 Quote

Status: offline

amckay

Forum User
Full Member
Registered: 03/23/02
Posts: 180
And in fact, before the DB_fetchArray() also add this :

Text Formatted Code

if ( 1 <> DB_numRows( $result ) ) {
           $retr  .= " ... " . $LANG_UPAGE['err_db_only_1'] . "[" . DB_numRows( $result ) . "]";
           return $retr;
}


 


so the whole segment will look like :

Text Formatted Code

 // now we have to re-lookup the one we just inserted

        $sql    = "SELECT * FROM {$_TABLES['upic']} "
                . " WHERE upic_uid = {$P['upic_uid']} "
                . " AND upic_file = "{$P['fclient']}" "
                . "";

        if ( ! $result = DB_query( $sql ) ) {
                $retr   .= " ... " . $LANG_UPAGE['upic_db_fail']
                        . " [" . $sql . "]";
                return $retr;
        }

        if ( 1 <> DB_numRows( $result ) ) {
                $retr  .= " ... " . $LANG_UPAGE['err_db_only_1'] . "[" . DB_numRows( $result ) . "]";
                return $retr;
        }

        $UP     = DB_fetchArray( $result );





 

 Quote

Status: offline

destr0yr

Forum User
Full Member
Registered: 07/06/02
Posts: 324
ok. i redl'd release 2 'cuz i foo bared a bit. Anyways.

I changed my pamfile to pnmfile. That's great.

I also changed lines 1346 thru to 1371. This includes all code from "now we have to re-lookup" to "and now do the highlight" to what you have above.

Tried uploading and I receive the following error:
Text Formatted Code
Warning: fopen(/home/okanagan/public_html/upage/upic/2/01092004.jpg): failed to open stream: No such file or directory in /home/okanagan/plugins/upage/functions.inc on line 1124

 

However, the file does upload, this error just appears above the header of the entire page.
Text Formatted Code
Uploading requested files    
[01092004.jpg] ...
        ... Successful file upload
        ... format checks out
        ... dimensions [450,270]
        ... aspect ratio 1.667
        ... non-standard aspect ratio 1.667
        ... thumb scaled
        ... small scaled
 


Checking line 1124-1129
Text Formatted Code
if ( $fd = fopen( $fname, "r" ) ) {
                fclose( $fd );
                $exists = 1;
                $retr   .= "        ... "
                        . $LANG_UPAGE['upic_replace'] . "<BR>";
        }

 

Is the function checking for the file that doesn't exist (and it doesn't exist because its still being uploaded) and spitting out the error confirming its non-existence?

-- destr0yr
"I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams
 Quote

Status: offline

amckay

Forum User
Full Member
Registered: 03/23/02
Posts: 180
Ah, the error is because you have error codes cranked up in PHP. I'm probably calling fopen the wrong way which doesn't help. Basically what I'm doing there is checking to see if the file already exists, in which case I later go on to do an 'update' in stead of an 'insert'.

I should actually change that to "file_exists". So you could replace that if/fopen with

Text Formatted Code

if ( file_exists( $fname ) ) {
        $exists = 1;
        $retr .= " ... "
              . $LANG_UPAGE['upic_replace'] . "<BR>";
}

 


I'll change my code, in fact.
 Quote

Status: offline

destr0yr

Forum User
Full Member
Registered: 07/06/02
Posts: 324
After making this change, I'd like to announce that, for the first time, I've been able to successfully run this plugin (and upload files) without any errors.

Thank you for your hard work and quick replies. Cool
-- destr0yr
"I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams
 Quote

Page navigation

All times are EST. The time is now 12:21 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content