@@ -356,43 +356,55 @@ protected function supportedFormatCheck()
356356 */
357357 public function save (?string $ target = null , int $ quality = 90 ): bool
358358 {
359+ echo "\n\nstart of save() with target: " . $ target . " and quality: " . $ quality . "\n" ;
359360 $ original = $ target ;
360361 $ target = ($ target === null || $ target === '' ) ? $ this ->image ()->getPathname () : $ target ;
361-
362+ echo " target is now: " . $ target . "\n" ;
362363 // If no new resource has been created, then we're
363364 // simply copy the existing one.
364365 if (! $ this ->resource instanceof Imagick && $ quality === 100 ) {
366+ echo "instance not Imagick, quality: " . $ quality . "\n" ;
365367 if ($ original === null ) {
368+ echo "original is null, return true \n" ;
366369 return true ;
367370 }
368371
369372 $ name = basename ($ target );
370373 $ path = pathinfo ($ target , PATHINFO_DIRNAME );
371-
374+ echo " return result from image()->copy() \n end of save() \n" ;
372375 return $ this ->image ()->copy ($ path , $ name );
373376 }
374-
377+ echo " ensureResource() call \n" ;
375378 $ this ->ensureResource ();
376-
379+ echo " setImageCompressionQuality() call \n" ;
377380 $ this ->resource ->setImageCompressionQuality ($ quality );
378-
381+ echo "if target is not null \n" ;
382+ var_dump ($ target );
379383 if ($ target !== null ) {
384+ echo "target is not null \n" ;
380385 $ extension = pathinfo ($ target , PATHINFO_EXTENSION );
386+ echo "setImageFormat() call \n" ;
387+ var_dump ($ extension );
381388 $ this ->resource ->setImageFormat ($ extension );
382389 }
383-
390+ echo " try... \n" ;
384391 try {
392+ echo "writeImage() call \n" ;
385393 $ result = $ this ->resource ->writeImage ($ target );
394+ echo "result: \n" ;
395+ var_dump ($ result );
386396
387397 chmod ($ target , $ this ->filePermissions );
388398
389399 $ this ->resource ->clear ();
390400 $ this ->resource = null ;
391-
401+ echo " return result \n end of save() \n" ;
392402 return $ result ;
393403 } catch (ImagickException ) {
404+ echo "EXCEPTION \n" ;
394405 throw ImageException::forSaveFailed ();
395406 }
407+ echo "last end of save() \n" ;
396408 }
397409
398410 /**
0 commit comments