original_string: public function image($img_url, $x, $y, $w, $h, $resolution = "normal")
      {
          $img_type = Cache::detect_type($img_url, $this->get_dompdf()->getHttpContext());
  
          if (!$img_type) {
              return;
          }
  
          $func_name = "imagecreatefrom$img_type";
          if (!function_exists($func_name)) {
              if (!method_exists("Dompdf\Helpers", $func_name)) {
                  throw new \Exception("Function $func_name() not found.  Cannot convert $img_type image: $img_url.  Please install the image PHP extension.");
              }
              $func_name = "\\Dompdf\\Helpers::" . $func_name;
          }
          $src = @call_user_func($func_name, $img_url);
  
          if (!$src) {
              return; // Probably should add to $_dompdf_errors or whatever here
          }
  
          // Scale by the AA factor and DPI
          $x = $this->_upscale($x);
          $y = $this->_upscale($y);
  
          $w = $this->_upscale($w);
          $h = $this->_upscale($h);
  
          $img_w = imagesx($src);
          $img_h = imagesy($src);
  
          imagecopyresampled($this->get_image(), $src, $x, $y, 0, 0, $w, $h, $img_w, $img_h);
      }
code: public function image($img_url, $x, $y, $w, $h, $resolution = "normal")
      {
          $img_type = Cache::detect_type($img_url, $this->get_dompdf()->getHttpContext());
  
          if (!$img_type) {
              return;
          }
  
          $func_name = "imagecreatefrom$img_type";
          if (!function_exists($func_name)) {
              if (!method_exists("Dompdf\Helpers", $func_name)) {
                  throw new \Exception("Function $func_name() not found.  Cannot convert $img_type image: $img_url.  Please install the image PHP extension.");
              }
              $func_name = "\\Dompdf\\Helpers::" . $func_name;
          }
          $src = @call_user_func($func_name, $img_url);
  
          if (!$src) {
              return; // Probably should add to $_dompdf_errors or whatever here
          }
  
          // Scale by the AA factor and DPI
          $x = $this->_upscale($x);
          $y = $this->_upscale($y);
  
          $w = $this->_upscale($w);
          $h = $this->_upscale($h);
  
          $img_w = imagesx($src);
          $img_h = imagesy($src);
  
          imagecopyresampled($this->get_image(), $src, $x, $y, 0, 0, $w, $h, $img_w, $img_h);
      }
code_tokens: public function image ( $ img_url , $ x , $ y , $ w , $ h , $ resolution = "normal" ) { $ img_type = Cache :: detect_type ( $ img_url , $ this -> get_dompdf ( ) -> getHttpContext ( ) ) ; if ( ! $ img_type ) { return ; } $ func_name = "imagecreatefrom$img_type" ; if ( ! function_exists ( $ func_name ) ) { if ( ! method_exists ( "Dompdf\Helpers" , $ func_name ) ) { throw new \ Exception ( "Function $func_name() not found.  Cannot convert $img_type image: $img_url.  Please install the image PHP extension." ) ; } $ func_name = "\\Dompdf\\Helpers::" . $ func_name ; } $ src = @ call_user_func ( $ func_name , $ img_url ) ; if ( ! $ src ) { return ; // Probably should add to $_dompdf_errors or whatever here } // Scale by the AA factor and DPI $ x = $ this -> _upscale ( $ x ) ; $ y = $ this -> _upscale ( $ y ) ; $ w = $ this -> _upscale ( $ w ) ; $ h = $ this -> _upscale ( $ h ) ; $ img_w = imagesx ( $ src ) ; $ img_h = imagesy ( $ src ) ; imagecopyresampled ( $ this -> get_image ( ) , $ src , $ x , $ y , 0 , 0 , $ w , $ h , $ img_w , $ img_h ) ; }
docstring: Add an image to the pdf.
  The image is placed at the specified x and y coordinates with the
  given width and height.
  
  @param string $img_url the path to the image
  @param float $x x position
  @param float $y y position
  @param int $w width (in pixels)
  @param int $h height (in pixels)
  @param string $resolution
  @return void
  
  @throws \Exception
  @internal param string $img_type the type (e.g. extension) of the image
docstring_tokens: Add an image to the pdf . The image is placed at the specified x and y coordinates with the given width and height .