phatgreenbuds Posted September 26, 2007 Share Posted September 26, 2007 Below is the code. I am trying to limit the image dimensions to a 4x6. The problem is how to define the variable for it to check...i keep getting and error saying that file does not exist. I know the problem is in this line list($width, $height) = getimagesize($fileName) ; so what should be in place of the $filename? <?php if(isset($_POST['upload']) && $_FILES['picname']['size'] > 0){ //IF 1-1 opens here and checks to make sure we are ready to go $targetdir = "../images/"; $targetdir_tn = "../images/tnails/"; $fileName = $_FILES['picname']['name']; $tmpName = $_FILES['picname']['tmp_name']; $fileSize = $_FILES['picname']['size']; $fileType = $_FILES['picname']['type']; $target = $targetdir . basename( $_FILES['picname']['name']); $target_tn = $targetdir_tn . basename( $_FILES['picname']['name']); $sub = $_POST['picsub']; $desc = $_POST['picdesc']; $limitedext = array(".jpg",".jpeg"); //Extensions you want files uploaded limited to. $ext = strrchr($fileName,'.'); if (!in_array(strtolower($ext),$limitedext)) { //IF 1-2 Opens here. Checks the extension from the above array echo "Wrong file extension. <br>"; } //closes IF 1-2 else{ //ELSE 1-2 Opens assuming the correct extension was matched list($width, $height) = getimagesize($fileName) ; if($width > 1800 && $height > 1200 || $width > 1200 && $height > 1800){ //IF 1-4 opens and check dimensions echo "<h4> Sorry the image is too big. Max image size is 4x6. Resize it and try again"; } //IF 1-4 Closes assuming dimensions are acceptable else { //ELSE 1-4 opens and continues processing Link to comment https://forums.phpfreaks.com/topic/70799-solved-image-size-restrictionshelp/ Share on other sites More sharing options...
apulmca2k4 Posted October 17, 2008 Share Posted October 17, 2008 Yes, I can do it. contact on [email protected] Link to comment https://forums.phpfreaks.com/topic/70799-solved-image-size-restrictionshelp/#findComment-667752 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.