$id ); $allow_big = false; switch( $cmd ) { case "img": if( $authlevel < 2 ) { $sql .= " and ff_state = \$2 and ff_public = 1"; $values[2] = FFS_ACTIVE; } if( $authlevel > 0 ) { $allow_big = true; } break; case "img_in": $sql .= " and ff_state = \$2"; $values[2] = FFS_INCOMING; $allow_big = true; if( $authlevel <= 0 ) { $size = ""; } break; case "img_any": $allow_big = true; if( $authlevel <= 0 ) { $size = ""; } break; default: $size = ""; break; } switch( $size ) { case "bg": if( !$allow_big ) { $size = ""; } break; case "sm": case "ti": case "TH": case "th": break; default: $size = ""; break; } $scale = 0; // echo "

size = $size

\n"; $imgfile = "blorg.png"; if( $size != "" ) { $ress = pg_query_params( $conn, $sql, $values ); if( $ress ) { $row = pg_fetch_array( $ress, NULL, PGSQL_ASSOC ); if( $row ) { $uid = $row["fu_id"]; $seq = $row["ff_seq_nr"]; $nam = $row["ff_filename"]; $pfx = substr( $nam, 0, strlen( $nam ) - 4 ); // $pfx = make_img_file_name( $uid, $seq ); $sfx = ".jpg"; // echo "

uid = $uid

\n"; // echo "

seq = $seq

\n"; // echo "

nam = $nam

\n"; // echo "

pfx = $pfx

\n"; // echo "

sfx = $sfx

\n"; switch( $size ) { case "th": $imgfile = $pfx . ".64" . $sfx; break; case "TH": $imgfile = $pfx . ".128" . $sfx; break; case "ti": $imgfile = $pfx . ".1024" . $sfx; $scale = 512; break; case "sm": $imgfile = $pfx . ".1024" . $sfx; break; case "bg": $imgfile = $pfx . $sfx; break; default: break; } } } } $filename = $G_CFG_DIR_LIB . "/" . $imgfile; // echo "

imgfile = $imgfile

\n"; if( $scale == 0 ) { $fd = fopen( $filename, "r" ); if( !$fd ) { return; } // header( "Cache-Control: no-cache, must-revalidate" ); // header( "Expires: Sat, 16 Jan 2038 05:30:00 GMT" ); set_caching(); header( "Content-type: image/jpeg" ); fpassthru( $fd ); fclose( $fd ); } else { gfx_send_scaled( $filename, $scale ); } } ?>