graphical_force Posted January 2, 2008 Share Posted January 2, 2008 Hello, I am using a script which uploads images. I am trying to check for a minimum image resolution. Any suggestions on how I may do that? Right now I have it where it checks for a maximum. Here is the code. Thanks in advance. <?php // Checks to make sure that user is logged in session_start(); if ( $_SESSION['user'] == null || $_SESSION['user'] < 1 ) { header( " Location: index.php" ); exit; } require_once( "DB.php" ); $dsn = 'mysql://hrpjeff_root:password@localhost/hrpjeff_time'; $db =& DB::Connect( $dsn, array() ); if (PEAR::isError($db)) { die($db->getMessage()); } $res = $db->query( "SELECT name FROM users WHERE id=?", array( $_SESSION['user'] ) ); $res->fetchInto( $row ); // filename: upload.form.php // first let's set some variables // make a note of the current working directory relative to root. $directory_self = str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']); // make a note of the location of the upload handler $uploadHandler = 'http://' . $_SERVER['HTTP_HOST'] . $directory_self . 'upload.processor.php'; // set a max file size for the html upload form $max_file_size = 30000; // size in bytes // now echo the html page ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <title>Upload form</title> </head> <body> <?php echo( $row[0] ); ?> <br/><br/> <a href="logout.php">Logout</a> <form id="Upload" action="<?php echo $uploadHandler ?>" enctype="multipart/form-data" method="post"> <h1> Upload form </h1> <p> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size ?>"> </p> <p> <label for="file">File to upload:</label> <input id="file" type="file" name="file"> </p> <p> <label for="submit">Press to...</label> <input id="submit" type="submit" name="submit" value="Upload me!"> </p> </form> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/84166-test-for-minimum-image-resolution/ Share on other sites More sharing options...
hitman6003 Posted January 2, 2008 Share Posted January 2, 2008 http://www.php.net/getimagesize http://www.php.net/imagesx http://www.php.net/imagesy Quote Link to comment https://forums.phpfreaks.com/topic/84166-test-for-minimum-image-resolution/#findComment-428548 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.