title: Change Image Size - PHP
body: <p>I have recently created an upload function, but I don't know how to change the width and height to 75px... I tried one code I found through Google, but I just got this error: </p>
  
  <pre><code>( ! ) Fatal error: Class 'Imagick' not found in C:\wamp\www\Legendary\new\usersettings.php on line 725
  Call Stack
  #   Time    Memory  Function    Location
  1   0.0042  880616  {main}( )   ..\usersettings.php:0
  </code></pre>
  
  <p>Here's my current code (including the code which didn't work):</p>
  
  <pre><code>echo '
                      &lt;table border="0" width="100%"&gt;
                      &lt;tr&gt;&lt;td style="font-size: 16px;"&gt;Change Image&lt;/td&gt;&lt;/tr&gt;
  
                      &lt;form action="" method="post" enctype="multipart/form-data"&gt;
                          &lt;tr&gt;&lt;td&gt;Upload Image:&lt;/td&gt;&lt;td style="text-align: right;"&gt;&lt;input type="file" name="upimage" id="upimage" /&gt;&lt;/td&gt;&lt;/tr&gt;
                          &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td style="text-align: right; font-size: 10px;"&gt;&lt;/td&gt;&lt;/tr&gt;
                          &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td style="text-align: right;"&gt;&lt;input type="submit" name="submitnewimage" value="Upload" class="button" /&gt;&lt;/td&gt;&lt;/tr&gt;
                      &lt;/form&gt;
                      ';
  
                      echo '
                      &lt;/table&gt;
                      ';
  
                      if(isset($_POST['submitnewimage'])){
                          $name = $_FILES['upimage']['name'];
                          $temp = $_FILES['upimage']['tmp_name'];
                          $type = $_FILES['upimage']['type'];
                          $size = $_FILES['upimage']['size'];
                          if($name!=""){
                              include 'config.php';
                              $sql5 = mysql_query("SELECT * FROM images ORDER BY id DESC LIMIT 1");
                              while($row=mysql_fetch_array($sql5)) {
                                  if(!isset($show2)){
                                      $id = $row['id'];
                                      $id = $id + 1;
  
                                      $show2 = "YES";
                                  }
                              }
  
                              if(($type=="image/jpeg") || ($type=="image/jpg") || ($type=="image/gif") || ($type=="image/pjpeg") || ($type=="image/png")){
                                  if($size&lt;=100000){
                                      $pos = strrpos($name, '.');
                                      if($pos === false)
                                          $ext = "";
                                      $ext = substr($name, $pos);
                                      $newFilename = $id.$ext;
  
                                      move_uploaded_file($temp, "images/teamicons/".$newFilename);
                                      $im = new Imagick('images/teamicons/'.$newFilename); 
                                      $im-&gt;thumbnailImage(75,75); 
                                      $im-&gt;writeImage('images/teamicons/'.$newFilename);
  
                                      mysql_query("INSERT INTO `images`(`id`, `name`, `size`, `type`) VALUES (NULL,'$newFilename',$size,'$type')");
                                      $myusername = $_SESSION['myusername'];
                                      mysql_query("UPDATE `members` SET `img`= '$newFilename' WHERE `username`='$myusername'");
  
                                      header("Location:" . $_SESSION['prev_page']);
                                  }else{echo "&lt;tr&gt;&lt;td colspan='2'&gt;&lt;span style='color:#F00;'&gt;The file, &amp;quot;".$name."&amp;quot;, is too large! Maximum allowed file size is 100kB.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;";}
                              }else{echo "&lt;tr&gt;&lt;td colspan='2'&gt;&lt;span style='color:#F00;'&gt;&amp;quot;".$type."&amp;quot; is not a valid file type!&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;";}
                          }else{echo "&lt;tr&gt;&lt;td colspan='2'&gt;&lt;span style='color:#F00;'&gt;No file has been specified!&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;";}
                      }
  </code></pre>
  
  <p>Is there any way of changing the width and height of the images?</p>