bigin / ItemManager_2.0

ItemManager (IM) is a simple flat-file framework for GetSimple-CMS that allows you to develop completely customizable PHP applications bundled with GetSimple-CMS.
MIT License
5 stars 3 forks source link

File upload field problems #9

Closed mittus closed 6 years ago

mittus commented 6 years ago

File upload field problems I use PHP 5.6 with nginx. With php 7 I not get first problem, but second problem is remains.

  1. When I try upload image, I see Server Error and don't see thumbnail screenshot_1 screenshot_2 screenshot_3
  2. After update page, it I click on the delete button, image don't delete, but folder /server/php was deleted. screenshot_4
bigin commented 6 years ago

Thanks for reporting. Could you please separate these issues? thx

mittus commented 6 years ago

ready :)

bigin commented 6 years ago

I have tested nginx, there are some issues here, so using ItemManager with nginx is currently not recommended. Thank you for reporting.

mittus commented 6 years ago

Problems with read index.php I was fix:

    # fix index.php
    location ~ ^/(plugins/imanager/upload/server/php)/ {
        try_files $uri $uri/ /index.php?$uri&$args;
    }

Other problems I can't fix. Hope that soon nginx will work. Than'k You for help!!

bigin commented 6 years ago

Here's what you could try: Change this line https://github.com/bigin/ItemManager_2.0/blob/master/imanager/upload/server/php/UploadHandler.php#L100 to 'delete_type' => 'POST', that might solve the problem with deleting, but I'm afraid there are more things that are causing trouble.

mittus commented 6 years ago

I can access to DELETE method on nginx with this:

server {
...
    dav_access user:rw group:rw all:rw;
    dav_methods PUT DELETE MKCOL COPY MOVE;
    create_full_put_path on;

But if I change delete_type to POST, I have correct deleting Image.

Now I have problems only with uploading files. I see 500 Server Error and this Error in data/other/logs/errorlog.txt: [04-Sep-2018 17:54:02 Europe/Moscow] NoDecodeDelegateForThisImageFormatJPEG' @ error/constitute.c/ReadImage/501`, then uploaded images haven't thumbnails.

bigin commented 6 years ago

The issue occurs only with PHP 5.6? With PHP 7> does the upload work, right?

mittus commented 6 years ago

Yes it's have problem only with PHP 5.6. With PHP 7 upload work!

bigin commented 6 years ago

Hmm, just tested with Ngnix and PHP 5.6 on MAMP and the upload works without problems for me. Did you get any error messages in your browser console on the item editor page before uploading?

bigin commented 6 years ago

I think it's a server configuration problem, because everything works for me, try to check your nginx error.log

mittus commented 6 years ago

No, it's a PHP error. I have install debug code to UploadHendler.php

ini_set('display_errors', 'On');
error_reporting(E_ALL);

And get this response:

<br />
<b>Fatal error</b>:  Uncaught exception 'ImagickException' with message 'NoDecodeDelegateForThisImageFormat `JPEG' @ error/constitute.c/ReadImage/501' in C:\srv\home\www\lpgroup.local\default.gs\html\plugins\imanager\upload\server\php\UploadHandler.php:923
Stack trace:
#0 C:\srv\home\www\lpgroup.local\default.gs\html\plugins\imanager\upload\server\php\UploadHandler.php(923): Imagick-&gt;readimage('C:/srv/home/www...')
#1 C:\srv\home\www\lpgroup.local\default.gs\html\plugins\imanager\upload\server\php\UploadHandler.php(979): UploadHandler-&gt;imagick_get_image_object('C:/srv/home/www...', false)
#2 C:\srv\home\www\lpgroup.local\default.gs\html\plugins\imanager\upload\server\php\UploadHandler.php(1137): UploadHandler-&gt;imagick_create_scaled_image('amt-gaz.jpg', '', Array)
#3 C:\srv\home\www\lpgroup.local\default.gs\html\plugins\imanager\upload\server\php\UploadHandler.php(1162): UploadHandler-&gt;create_scaled_image('amt-gaz.jpg', '', Array)
#4 C:\srv\home\www\lpgroup.local\default.gs\html\plugins\imanager\upload\server\php\UploadHandler.php in <b>C:\srv\home\www\lpgroup.local\default.gs\html\plugins\imanager\upload\server\php\UploadHandler.php</b> on line <b>923</b><br />
mittus commented 6 years ago

On Nginx logs I have empty data. For reading index.php in getsimple now I use this config:

    location ~* \/?$ {
        try_files $uri $uri/ /index.php?id=$uri&$args;
    }
bigin commented 6 years ago

This looks like that's an imagick error

bigin commented 6 years ago

imagick isn't installed properly?

bigin commented 6 years ago

Probably imagick is running without support for the image format that you're trying to open JPEG. Try other format - png for example

mittus commented 6 years ago

It's true. I have problem with imagick plugin. I will fix that. Thank you for answers!! screenshot_9

UPD For fix that, use similar installed ImageMagick version, and remove all *CORE_.dll** from php folder. Can download here: https://ftp.icm.edu.pl/packages/ImageMagick/binaries/

After fix in phpinfo you see this: screenshot_13

bigin commented 6 years ago

Thank you for reporting the issues ;-)

mittus commented 6 years ago

I was fix problem with imagick, but now have new problem ))) It actual for different images. Only with PHP 5.6 screenshot_10

UPD. And this: <b>Warning</b>: Imagick::resizeimage() expects parameter 1 to be long, object given in <b>C:\srv\home\www\lpgroup.local\default.gs\html\plugins\imanager\upload\server\php\UploadHandler.php</b> on line <b>1025</b><br />

mittus commented 6 years ago

This problem actual, becouse $new_width in 1019 line is an Object. Now I try fix that :) screenshot_11

mittus commented 6 years ago

Did this, and now it works 😆 screenshot_12

bigin commented 6 years ago

Hmm OK, I need to check that, I may have to fix that, thx!

bigin commented 6 years ago

Should be fixed, please check: f83a7ac

mittus commented 6 years ago

Now it works. Thank You!!