The API method pwg.categories.getImages calls the PHP method getimagesize() in …/include/derivative.inc.php on line 146:
if ( ($size = getimagesize( $this->get_path() )) !== false)
{
$this->size = array($size[0],$size[1]);
pwg_query('UPDATE '.IMAGES_TABLE.' SET width='.$size[0].', height='.$size[1].' WHERE id='.$this->id);
}
If getimagesize() encounters an error with an image, the API method pwg.categories.getImages does not return any data, preventing the third party app to retrieve the album image list.
What would be expected is that pwg.categories.getImages forgets the problematic image and returns the rest of the data.
The API method `pwg.categories.getImages` calls the PHP method [`getimagesize()`](https://www.php.net/manual/en/function.getimagesize.php) in …/include/derivative.inc.php on line 146:
```
if ( ($size = getimagesize( $this->get_path() )) !== false)
{
$this->size = array($size[0],$size[1]);
pwg_query('UPDATE '.IMAGES_TABLE.' SET width='.$size[0].', height='.$size[1].' WHERE id='.$this->id);
}
```
If `getimagesize()` encounters an error with an image, the API method `pwg.categories.getImages` does not return any data, preventing the third party app to retrieve the album image list.
What would be expected is that `pwg.categories.getImages` forgets the problematic image and returns the rest of the data.
<!-- github-sync-id:646959466 -->
I encounter the same problem again and I realise that the API method pwg.categories.getImages returns no data after an unsuccessful JSON parsing. The server returns the following data when there is a corrupted image file image.jpg in the album:
<br />
<b>Warning</b>: getimagesize(././upload/2020/08/19/image.jpg): failed to open stream: No such file or directory in <b>[hidden path]/htdocs/Piwigo/include/derivative.inc.php</b> on line <b>146</b><br />
{"stat":"ok","result":{"paging":{"page":0,"per_page":36,"count":32,"total_count":"32"},"images":[{"id":9651,"hit":0,"file":"IMG_1410.JPG",...
Can we prevent the server from returning the HTML code before the JSON data?
I encounter the same problem again and I realise that the API method `pwg.categories.getImages` returns no data **after an unsuccessful JSON parsing**. The server returns the following data when there is a corrupted image file `image.jpg` in the album:
```
<br />
<b>Warning</b>: getimagesize(././upload/2020/08/19/image.jpg): failed to open stream: No such file or directory in <b>[hidden path]/htdocs/Piwigo/include/derivative.inc.php</b> on line <b>146</b><br />
{"stat":"ok","result":{"paging":{"page":0,"per_page":36,"count":32,"total_count":"32"},"images":[{"id":9651,"hit":0,"file":"IMG_1410.JPG",...
```
Can we prevent the server from returning the HTML code before the JSON data?
<!-- github-comment-id:676279855 -->
I still have no time to fix the error in PHP but it should be possible.
Getimage size returns an error if the file not exists or you don't have
permission on the file or the file is video. There are two solutions:
Add try - catch statement to prevent this errors
Or find PHP libraries which are capable to read the video files
But on both solutions you will probably prevent the HTMP/ PHP error but you
get the empty JSON response, which is not good. You should get me the JSON
template and I should find time to fix it :-).
I encounter the same problem again and I realise that the API method pwg.
categories.getImages returns no data after JSON parsing. In fact here is the
beginning of the returned data:
Warning: getimagesize(././upload/2020/08/19/20200819062113-d51ffc4d.jpg): failed to open stream: No such file or directory in [hidden path]/htdocs/Piwigo/include/derivative.inc.php on line 146
Hello,
I still have no time to fix the error in PHP but it should be possible.
Getimage size returns an error if the file not exists or you don't have
permission on the file or the file is video. There are two solutions:
1. Add try - catch statement to prevent this errors
2. Or find PHP libraries which are capable to read the video files
But on both solutions you will probably prevent the HTMP/ PHP error but you
get the empty JSON response, which is not good. You should get me the JSON
template and I should find time to fix it :-).
Regards.
Jan
---------- Původní e-mail ----------
Od: Eddy Lelièvre-Berna <notifications@github.com>
Komu: Piwigo/Piwigo <Piwigo@noreply.github.com>
Datum: 19. 8. 2020 14:35:53
Předmět: Re: [Piwigo/Piwigo] [web API] pwg.categories.getImages returns <
NULL> if getimagesize() fails (#1198)
"
I encounter the same problem again and I realise that the API method pwg.
categories.getImages returns no data after JSON parsing. In fact here is the
beginning of the returned data:
<code><br />
<b>Warning</b>: getimagesize(././upload/2020/08/19/20200819062113-d51ffc4d.jpg): failed to open stream: No such file or directory in <b>[hidden path]/htdocs/Piwigo/include/derivative.inc.php</b> on line <b>146</b><br />
{"stat":"ok","result":{"paging":{"page":0,"per_page":36,"count":32,"total_count":"32"},"images":[{"id":9651,"hit":0,"file":"IMG_1410.JPG",...
</code>
Can we prevent the server from returning the HTML code before the JSON data?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
(https://github.com/Piwigo/Piwigo/issues/1198#issuecomment-676279855), or
unsubscribe
(https://github.com/notifications/unsubscribe-auth/AB3XG7F34LVWVCUOYNP32KDSBPBKHANCNFSM4OKTICFA)
.
"
<!-- github-comment-id:676587580 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The API method
pwg.categories.getImagescalls the PHP methodgetimagesize()in …/include/derivative.inc.php on line 146:If
getimagesize()encounters an error with an image, the API methodpwg.categories.getImagesdoes not return any data, preventing the third party app to retrieve the album image list.What would be expected is that
pwg.categories.getImagesforgets the problematic image and returns the rest of the data.It happens if there are the corrupted photos or any video files.
I encounter the same problem again and I realise that the API method
pwg.categories.getImagesreturns no data after an unsuccessful JSON parsing. The server returns the following data when there is a corrupted image fileimage.jpgin the album:Can we prevent the server from returning the HTML code before the JSON data?
Hello,
I still have no time to fix the error in PHP but it should be possible.
Getimage size returns an error if the file not exists or you don't have
permission on the file or the file is video. There are two solutions:
But on both solutions you will probably prevent the HTMP/ PHP error but you
get the empty JSON response, which is not good. You should get me the JSON
template and I should find time to fix it :-).
Regards.
Jan
---------- Původní e-mail ----------
Od: Eddy Lelièvre-Berna notifications@github.com
Komu: Piwigo/Piwigo Piwigo@noreply.github.com
Datum: 19. 8. 2020 14:35:53
Předmět: Re: [Piwigo/Piwigo] [web API] pwg.categories.getImages returns <
NULL> if getimagesize() fails (#1198)
"
I encounter the same problem again and I realise that the API method pwg.
categories.getImages returns no data after JSON parsing. In fact here is the
beginning of the returned data:
Warning: getimagesize(././upload/2020/08/19/20200819062113-d51ffc4d.jpg): failed to open stream: No such file or directory in [hidden path]/htdocs/Piwigo/include/derivative.inc.php on line 146
{"stat":"ok","result":{"paging":{"page":0,"per_page":36,"count":32,"total_count":"32"},"images":[{"id":9651,"hit":0,"file":"IMG_1410.JPG",...
Can we prevent the server from returning the HTML code before the JSON data?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
(https://github.com/Piwigo/Piwigo/issues/1198#issuecomment-676279855), or
unsubscribe
(https://github.com/notifications/unsubscribe-auth/AB3XG7F34LVWVCUOYNP32KDSBPBKHANCNFSM4OKTICFA)
.
"
I close this issue which is in fact a duplicate of #1566.