title: Define image max and min width height on upload
body: <p>I really searched all the site and tried to use GD getimagesize function,But no hope
  please i want to set min and max image width and height on upload..so if not equal then show error;
  here is original code:</p>
  
  <pre><code>    &lt;?php
  $page = "user_editprofile_photo";
  include "header.php";
  $task = ( isset($_POST['task']) ? $_POST['task'] : NULL );
  // CHECK FOR ADMIN ALLOWANCE OF PHOTO
  if( !$user-&gt;level_info['level_photo_allow'] )
  {
    header("Location: user_home.php");
    exit();
  }
  // SET ERROR VARIABLES
  $is_error = 0;
  // DELETE PHOTO
  if( $task == "remove" )
  {
    $user-&gt;user_photo_delete();
    $user-&gt;user_lastupdate();
    exit();
  }
  // UPLOAD PHOTO
  if( $task == "upload" )
  {
    $user-&gt;user_photo_upload("photo");
    $is_error = $user-&gt;is_error;
    if( !$is_error )
    {
      // SAVE LAST UPDATE DATE
      $user-&gt;user_lastupdate(); 
      // DETERMINE SIZE OF THUMBNAIL TO SHOW IN ACTION
      $photo_width = $misc-&gt;photo_size($user-&gt;user_photo(), "100", "100", "w");
      $photo_height = $misc-&gt;photo_size($user-&gt;user_photo(), "100", "100", "h");
  
      // INSERT ACTION
      $action_media = Array(Array('media_link'=&gt;$url-&gt;url_create('profile', $user-&gt;user_info['user_username']), 'media_path'=&gt;$user-&gt;user_photo(), 'media_width'=&gt;$photo_width, 'media_height'=&gt;$photo_height));
      $actions-&gt;actions_add($user, "editphoto", Array($user-&gt;user_info['user_username'], $user-&gt;user_displayname), $action_media, 999999999, TRUE, "user", $user-&gt;user_info['user_id'], $user-&gt;user_info['user_privacy']);
    }
  }
  
  // GET TABS TO DISPLAY ON TOP MENU
  $field = new se_field("profile", $user-&gt;profile_info);
  $field-&gt;cat_list(0, 0, 0, "profilecat_id='{$user-&gt;user_info['user_profilecat_id']}'");
  $cat_array = $field-&gt;subcats;
  
  
  // ASSIGN VARIABLES AND INCLUDE FOOTER
  $smarty-&gt;assign('is_error', $is_error);
  $smarty-&gt;assign('cats', $cat_array);
  include "footer.php";
  ?&gt;
  </code></pre>
  
  <p>here what i add:</p>
  
  <pre><code>if( $task == "upload" )
  $photo=$user-&gt;user_photo();
  {
  list($img_width, $img_height, $img_type, $attrs)=getimagesize($photo);
    if($img_width &gt;= 193 &amp;&amp; $img_height &gt;= 290)
    $user-&gt;user_photo_upload("photo");
    $is_error = $user-&gt;is_error;
    if( !$is_error )
  </code></pre>
  
  <p>1-In this way:</p>
  
  <pre><code>if($task == "upload")$photo = $user-&gt;user_photo();
    { $user-&gt;user_photo_upload("photo");
  </code></pre>
  
  <p>no image will uploaded at all.....</p>
  
  <p>2- in this way:</p>
  
  <pre><code>    if($task == "upload"){  
  $user-&gt;user_photo_upload("photo");
  $photo = $user-&gt;user_photo();
  </code></pre>
  
  <p>No effect..and it uploads even 16px image.
  Thank you
  Please if you can help.i will be so grateful.</p>