Notice: Use $presenter->sendPayload() instead of terminate() to send payload

crookslovacko
Člen | 74
+
0
-

Dobrý den,

po nahrání na produkci se mi objevuje notice po nahrávání orázku a obrázek se nenahraje.

Notice: Use $presenter->sendPayload() instead of terminate() to send payload

handle

public function handleuploadimage()
    {
       $files = $this->presenter->getHttpRequest()->getFiles();
       $file = $files['fileimage'];
       $picture_id = $this->presenter->getHttpRequest()->getPost('picture_id');
       $storyboards_id = $this->presenter->getHttpRequest()->getPost('storyboards_id');
       bdump($file);
       if($file->isImage() and $file->isOk()) {
           $file_ext=strtolower(mb_substr($file->getSanitizedName(), strrpos($file->getSanitizedName(), ".")));
           $file_name = $picture_id.$file_ext;
           $file_name_r = $picture_id.'resize'.$file_ext;
           $file->move($this->path.$storyboards_id.'/'.$file_name);
           $image_gd = imagecreatefromjpeg($this->path.$storyboards_id.'/'.$file_name);
           $ratio = 1024 / imagesx($image_gd);
           $height = imagesy($image_gd) * $ratio;
           $new_image = imagecreatetruecolor(1024, intval($height));
           imagecopyresampled($new_image, $image_gd, 0, 0, 0, 0, 1024, intval($height), imagesx($image_gd), imagesy($image_gd));
           imagejpeg($new_image, $this->path.$storyboards_id.'/'.$file_name_r, 90);
           //$image_resize = imagescale ( $image_gd , 1024 , 768 );
           //$image_resize->save(__DIR__ . '../../../www/'.'/'.$storyboards_id.'/'.$file_name_r);
           $this->filmsData->updatePicture($picture_id, array('picture'=>$file_name,
                                                              'file_ext'=>$file_ext,
                                                               'max_height'=>$height));
           bdump('jelo123');
       }
    }

Nejhorší je, že absolutně nevím proč lokal OK a produkce nic. Toto je přímo z logu tak nějak už nevím kde víc zjistit.
googl poradil jen jednu zmínku a ta nepomohla Ví někdo radu? Samozřejmě tmp a cache promazáno

<script>
      function uploadimage(){
                         let formData = new FormData();
                         var d = $('#image')[0].files[0];
                         let picture_id = document.getElementById("picture_id").value;
                         let storyboards_id = document.getElementById("storyboards_id").value;
                         formData.append('fileimage',d);
                         formData.append('picture_id',picture_id);
                         formData.append('storyboards_id',storyboards_id);
                         var link = $('#image').data('href');
                         $.ajax({
                                type: 'POST',
                                url: link,
                                contentType: false,
                                processData: false,
                                data: formData
                        });

                };
        </script>

Editoval crookslovacko (19. 1. 2023 19:19)