@@ -365,27 +365,12 @@ public function image(string $prompt, int $width = 1024, int $height = 1024, int
365365 }
366366
367367 if ($ resize ) {
368- Tools::log ('openai-image ' )->info ('attempting image resize ' , [
369- 'from_path ' => $ file_path ,
370- 'to_size ' => $ width . 'x ' . $ height
371- ]);
372-
373368 $ resized = $ this ->imageResize ($ file_path , $ width , $ height );
374369
375- Tools::log ('openai-image ' )->info ('resize result ' , [
376- 'resized_path ' => $ resized ,
377- 'is_empty ' => empty ($ resized )
378- ]);
379-
380370 if (!empty ($ resized )) {
381371 unlink ($ file_path );
382372 return $ resized ;
383373 }
384-
385- Tools::log ('openai-image ' )->error ('image resize failed, returning original size ' , [
386- 'original_path ' => $ file_path ,
387- 'requested_size ' => $ width . 'x ' . $ height
388- ]);
389374 }
390375
391376 return $ file_path ;
@@ -652,23 +637,11 @@ private function getImageSize(bool &$resize, int $width, int $height): string
652637
653638 private function imageResize (string $ filePath , int $ width , int $ height ): string
654639 {
655- Tools::log ('openai-image ' )->info ('imageResize called ' , [
656- 'file ' => $ filePath ,
657- 'target_width ' => $ width ,
658- 'target_height ' => $ height
659- ]);
660-
661640 try {
662641 $ image = imagecreatefromstring (file_get_contents ($ filePath ));
663642 $ imageWidth = imagesx ($ image );
664643 $ imageHeight = imagesy ($ image );
665644
666- Tools::log ('openai-image ' )->info ('original image dimensions ' , [
667- 'width ' => $ imageWidth ,
668- 'height ' => $ imageHeight ,
669- 'resizing_to ' => $ width . 'x ' . $ height
670- ]);
671-
672645 $ thumb = imagecreatetruecolor ($ width , $ height );
673646
674647 // Preservar transparencia para PNG
@@ -700,11 +673,6 @@ private function imageResize(string $filePath, int $width, int $height): string
700673
701674 imagedestroy ($ image );
702675 imagedestroy ($ thumb );
703-
704- Tools::log ('openai-image ' )->info ('image resize successful ' , [
705- 'output_file ' => $ thumbFile ,
706- 'final_size ' => $ width . 'x ' . $ height
707- ]);
708676 } catch (Throwable $ th ) {
709677 Tools::log ('openai-image ' )->error ('image resize error: ' . $ th ->getMessage ());
710678 return '' ;
0 commit comments