original_string: public function resize($width, $height)
      {
          //if the width is not specified, make it relative to the height
          if($width == -1){
  
              $this->width['dest'] = ($height * $this->width['orig']) / $this->height['orig'];
              $this->height['dest'] = $height;
  
          //if the height is not specified, make it relative to the width
          } elseif ($height == -1){
  
              $this->width['dest'] = $width;
              $this->height['dest'] = ($width * $this->height['orig']) / $this->width['orig'];
  
          } else {
  
              $this->width['dest'] = $width;
              $this->height['dest'] = $height;
          }
  
          //set resize code depending on the type of image it is
          switch ($this->type)
  
      {
              case "gif":
                  $this->edited = imagecreate($this->width['dest'], $this->height['dest']);
  
                  imagecopyresampled($this->edited, $this->original, 0, 0, 0, 0, $this->width['dest'], $this->height['dest'], $this->width['orig'], $this->height['orig']);
  
              break;
  
              case "jpg":
                  $this->edited = imagecreatetruecolor($this->width['dest'], $this->height['dest']);
  
                  imagecopyresampled($this->edited, $this->original, 0, 0, 0, 0, $this->width['dest'], $this->height['dest'], $this->width['orig'], $this->height['orig']);
  
  
              break;
  
              case "png":
  
                  $this->edited = imagecreatetruecolor ($this->width['dest'], $this->height['dest']);
  
                  //preserve the alpha if exists
                  imagealphablending($this->edited, false);
                  imagesavealpha($this->edited, true);
  
                  imagecopyresampled($this->edited, $this->original, 0, 0, 0, 0, $this->width['dest'], $this->height['dest'], $this->width['orig'], $this->height['orig']);
  
              break;
          }
  
      }
code: public function resize($width, $height)
      {
          //if the width is not specified, make it relative to the height
          if($width == -1){
  
              $this->width['dest'] = ($height * $this->width['orig']) / $this->height['orig'];
              $this->height['dest'] = $height;
  
          //if the height is not specified, make it relative to the width
          } elseif ($height == -1){
  
              $this->width['dest'] = $width;
              $this->height['dest'] = ($width * $this->height['orig']) / $this->width['orig'];
  
          } else {
  
              $this->width['dest'] = $width;
              $this->height['dest'] = $height;
          }
  
          //set resize code depending on the type of image it is
          switch ($this->type)
  
      {
              case "gif":
                  $this->edited = imagecreate($this->width['dest'], $this->height['dest']);
  
                  imagecopyresampled($this->edited, $this->original, 0, 0, 0, 0, $this->width['dest'], $this->height['dest'], $this->width['orig'], $this->height['orig']);
  
              break;
  
              case "jpg":
                  $this->edited = imagecreatetruecolor($this->width['dest'], $this->height['dest']);
  
                  imagecopyresampled($this->edited, $this->original, 0, 0, 0, 0, $this->width['dest'], $this->height['dest'], $this->width['orig'], $this->height['orig']);
  
  
              break;
  
              case "png":
  
                  $this->edited = imagecreatetruecolor ($this->width['dest'], $this->height['dest']);
  
                  //preserve the alpha if exists
                  imagealphablending($this->edited, false);
                  imagesavealpha($this->edited, true);
  
                  imagecopyresampled($this->edited, $this->original, 0, 0, 0, 0, $this->width['dest'], $this->height['dest'], $this->width['orig'], $this->height['orig']);
  
              break;
          }
  
      }
code_tokens: public function resize ( $ width , $ height ) { //if the width is not specified, make it relative to the height if ( $ width == - 1 ) { $ this -> width [ 'dest' ] = ( $ height * $ this -> width [ 'orig' ] ) / $ this -> height [ 'orig' ] ; $ this -> height [ 'dest' ] = $ height ; //if the height is not specified, make it relative to the width } elseif ( $ height == - 1 ) { $ this -> width [ 'dest' ] = $ width ; $ this -> height [ 'dest' ] = ( $ width * $ this -> height [ 'orig' ] ) / $ this -> width [ 'orig' ] ; } else { $ this -> width [ 'dest' ] = $ width ; $ this -> height [ 'dest' ] = $ height ; } //set resize code depending on the type of image it is switch ( $ this -> type ) { case "gif" : $ this -> edited = imagecreate ( $ this -> width [ 'dest' ] , $ this -> height [ 'dest' ] ) ; imagecopyresampled ( $ this -> edited , $ this -> original , 0 , 0 , 0 , 0 , $ this -> width [ 'dest' ] , $ this -> height [ 'dest' ] , $ this -> width [ 'orig' ] , $ this -> height [ 'orig' ] ) ; break ; case "jpg" : $ this -> edited = imagecreatetruecolor ( $ this -> width [ 'dest' ] , $ this -> height [ 'dest' ] ) ; imagecopyresampled ( $ this -> edited , $ this -> original , 0 , 0 , 0 , 0 , $ this -> width [ 'dest' ] , $ this -> height [ 'dest' ] , $ this -> width [ 'orig' ] , $ this -> height [ 'orig' ] ) ; break ; case "png" : $ this -> edited = imagecreatetruecolor ( $ this -> width [ 'dest' ] , $ this -> height [ 'dest' ] ) ; //preserve the alpha if exists imagealphablending ( $ this -> edited , false ) ; imagesavealpha ( $ this -> edited , true ) ; imagecopyresampled ( $ this -> edited , $ this -> original , 0 , 0 , 0 , 0 , $ this -> width [ 'dest' ] , $ this -> height [ 'dest' ] , $ this -> width [ 'orig' ] , $ this -> height [ 'orig' ] ) ; break ; } }
docstring: Resizes an the edited image to the specified width and height
  
  @param int $width can be * to make it relative to a specified height
  @param int $height can be * to make it relative to a specified width
docstring_tokens: Resizes an the edited image to the specified width and height