3v4l.org

run code in 300+ PHP versions simultaneously
<?php function resizeImg($img, $width, $height, $path) { $i = new Imagick($img); $i->scaleImage($width, $height); $gig = $i->getImageGeometry(); if(($gig['width']/$width) < ($gig['height']/$height)) { $i->cropImage($gig['width'], floor($height * $gig['width'] / $width), 0, (($gig['height'] - ($height * $gig['width'] / $width)) / 2)); } else { $i->cropImage(ceil($width * $gig['height'] / $height), $gig['height'], (($gig['width'] - ($width * $gig['height'] / $height)) / 2), 0); } $i->ThumbnailImage($width, $height,true); $i->setImageFormat("jpeg"); $i->setImageCompressionQuality(90); $i->writeImage($path); return $i->getimage(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WbmU1
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E > > RETURN                                                   1

Function resizeimg:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 42
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WbmU1
function name:  resizeImg
number of ops:  80
compiled vars:  !0 = $img, !1 = $width, !2 = $height, !3 = $path, !4 = $i, !5 = $gig
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
    4     4        NEW                                              $6      'Imagick'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !4, $6
    5     8        INIT_METHOD_CALL                                         !4, 'scaleImage'
          9        SEND_VAR_EX                                              !1
         10        SEND_VAR_EX                                              !2
         11        DO_FCALL                                      0          
    6    12        INIT_METHOD_CALL                                         !4, 'getImageGeometry'
         13        DO_FCALL                                      0  $10     
         14        ASSIGN                                                   !5, $10
    8    15        FETCH_DIM_R                                      ~12     !5, 'width'
         16        DIV                                              ~13     ~12, !1
         17        FETCH_DIM_R                                      ~14     !5, 'height'
         18        DIV                                              ~15     ~14, !2
         19        IS_SMALLER                                               ~13, ~15
         20      > JMPZ                                                     ~16, ->42
   10    21    >   INIT_METHOD_CALL                                         !4, 'cropImage'
         22        CHECK_FUNC_ARG                                           
         23        FETCH_DIM_FUNC_ARG                               $17     !5, 'width'
         24        SEND_FUNC_ARG                                            $17
         25        INIT_FCALL                                               'floor'
         26        FETCH_DIM_R                                      ~18     !5, 'width'
         27        MUL                                              ~19     !2, ~18
         28        DIV                                              ~20     ~19, !1
         29        SEND_VAL                                                 ~20
         30        DO_ICALL                                         $21     
         31        SEND_VAR_NO_REF_EX                                       $21
         32        SEND_VAL_EX                                              0
         33        FETCH_DIM_R                                      ~22     !5, 'height'
         34        FETCH_DIM_R                                      ~23     !5, 'width'
         35        MUL                                              ~24     !2, ~23
         36        DIV                                              ~25     ~24, !1
         37        SUB                                              ~26     ~22, ~25
         38        DIV                                              ~27     ~26, 2
         39        SEND_VAL_EX                                              ~27
         40        DO_FCALL                                      0          
         41      > JMP                                                      ->62
   14    42    >   INIT_METHOD_CALL                                         !4, 'cropImage'
         43        INIT_FCALL                                               'ceil'
         44        FETCH_DIM_R                                      ~29     !5, 'height'
         45        MUL                                              ~30     !1, ~29
         46        DIV                                              ~31     ~30, !2
         47        SEND_VAL                                                 ~31
         48        DO_ICALL                                         $32     
         49        SEND_VAR_NO_REF_EX                                       $32
         50        CHECK_FUNC_ARG                                           
         51        FETCH_DIM_FUNC_ARG                               $33     !5, 'height'
         52        SEND_FUNC_ARG                                            $33
         53        FETCH_DIM_R                                      ~34     !5, 'width'
         54        FETCH_DIM_R                                      ~35     !5, 'height'
         55        MUL                                              ~36     !1, ~35
         56        DIV                                              ~37     ~36, !2
         57        SUB                                              ~38     ~34, ~37
         58        DIV                                              ~39     ~38, 2
         59        SEND_VAL_EX                                              ~39
         60        SEND_VAL_EX                                              0
         61        DO_FCALL                                      0          
   17    62    >   INIT_METHOD_CALL                                         !4, 'ThumbnailImage'
         63        SEND_VAR_EX                                              !1
         64        SEND_VAR_EX                                              !2
         65        SEND_VAL_EX                                              <true>
         66        DO_FCALL                                      0          
   18    67        INIT_METHOD_CALL                                         !4, 'setImageFormat'
         68        SEND_VAL_EX                                              'jpeg'
         69        DO_FCALL                                      0          
   19    70        INIT_METHOD_CALL                                         !4, 'setImageCompressionQuality'
         71        SEND_VAL_EX                                              90
         72        DO_FCALL                                      0          
   20    73        INIT_METHOD_CALL                                         !4, 'writeImage'
         74        SEND_VAR_EX                                              !3
         75        DO_FCALL                                      0          
   21    76        INIT_METHOD_CALL                                         !4, 'getimage'
         77        DO_FCALL                                      0  $45     
         78      > RETURN                                                   $45
   22    79*     > RETURN                                                   null

End of function resizeimg

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.82 ms | 1400 KiB | 17 Q