Jump to content

Recommended Posts

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>

Link to comment
https://forums.phpfreaks.com/topic/84166-test-for-minimum-image-resolution/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.