typemill: "Imagefile is missing" when uploading an image

Hi πŸ‘‹ first of all: kudo’s for this great project πŸ‘

I just installed Typemill via the included Dockerfile in this repo. Version is: 2.14.5

When uploading an image via the WYSIWYG editor I get the error: Imagefile is missing.

Image

I don’t see anything special in the logs despite having displayErrorDetails: true in settings.yaml Permissions on file system level (within the container) look alright to me. The strange part is that a tmpfile gets uploaded:

root@typemill:/var/www/html/media# find .
.
./tmp
./tmp/ORIGINAL+58a801e0-3f23-4675-8962-85fe02c494f6.jpg
./original
./live
./thumbs
./custom
./files
root@typemill:/var/www/html/media# ls -hal tmp/
total 1.6M
drwxr-xr-x 2 www-data www-data   63 Feb 28 22:08 .
drwxr-xr-x 8 www-data www-data   86 Feb 28 20:09 ..
-rw-r--r-- 1 www-data www-data 1.6M Feb 28 22:11 ORIGINAL+58a801e0-3f23-4675-8962-85fe02c494f6.jpg
root@typemill:/var/www/html/media# ls -hal thumbs/
total 0
drwxr-xr-x 2 www-data www-data  6 Feb 28 20:09 .
drwxr-xr-x 8 www-data www-data 86 Feb 28 20:09 ..
root@typemill:/var/www/html/media# ls -hal original/
total 0
drwxr-xr-x 2 www-data www-data  6 Feb 28 20:09 .
drwxr-xr-x 8 www-data www-data 86 Feb 28 20:09 ..

image-gd is also active in the php config:

gd

GD Support => enabled
GD Version => bundled (2.1.0 compatible)
GIF Read Support => enabled
GIF Create Support => enabled
PNG Support => enabled
libPNG Version => 1.6.37
WBMP Support => enabled
XBM Support => enabled
BMP Support => enabled
TGA Read Support => enabled

Directive => Local Value => Master Value
gd.jpeg_ignore_warning => 1 => 1

Is this a known bug? Do you have any advice on where to start troubleshooting?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

ok, release 2.16.0 is out, please create a new dockerimage and try again, I tested it and it works for me. The new dockerfile installs the missing jpeg library.

ok, I checked it, if you activate the error reporting and then upload a jpg with developer tools open, then you can see an error messsage in the response:

Warning: imagecreatefromstring(): No JPEG support in this PHP build in /var/www/html/system/typemill/Models/Media.php on line 407
{ "message": "Slim Application Error", "exception": [ { "type": "TypeError", "code": 0, "message": "imagesx(): Argument #1 ($image) must be of type GdImage, bool given", "file": "/var/www/html/system/typemill/Models/Media.php", "line": 412 } ] }

I will try to fix it for this release, so add a proper error handling in Typemill and add the missing library and configuration to the docker setup. And I will try to get a new docker setup soon with an official docker image on dockerhub, hopefully with release 2.17

Thank you again for finding this, and sorry for late reply, it is sometimes hard to find time for all tasks …

I have found a permanent workaround. Basically, the data folders …/typemill/media/files and …/typemill/media/tmp are missing. So, take the following steps.

  1. Create β€˜tmp’ and β€˜files’ folder in …/typemill/media
  2. In typemill, click β€˜kixote’ and execute the commands
    • clear cache
    • clear navigation
  3. Restart the docker container.

@trendschau. Could you automatically create these folders in a new release?

Looking in ControllerApiFile.php, it is clear you need these folders.

		$fileinfo = $media->storeFile($params['file'], $params['name']);
		if(!$fileinfo OR !isset($fileinfo['url']))
		{
			$response->getBody()->write(json_encode([
				'message' 		=> Translations::translate('We Could not store file to temporary folder.'),
				'fullerrors'	=> $media->errors
			]));

			return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
		}

		# if the previous check of the mtype with the base64 string failed, then do it now again with the temporary file
		if(!$mtype)
		{
			$filePath = str_replace('media/files', 'media/tmp', $fileinfo['url']);
			$filePath = str_replace('/', DIRECTORY_SEPARATOR, $filePath);
			$fullPath 	= $this->settings['rootPath'] . DIRECTORY_SEPARATOR . $filePath;
			$finfo 		= finfo_open( FILEINFO_MIME_TYPE );
			$mtype 		= @finfo_file( $finfo, $fullPath );
			finfo_close($finfo);

sorry for the late answer, I missed this! What looks strange to me is that there are two tmp-folders, I guess that Typemill tries to find the file in the empty folder.

The logic is that Typemill uploads the original image to the temp folder on upload, and only stores the different sizes of the image in the productive folders if the author clicks on save (saves the block). If not, it deletes the temporary files again.

Did you use the dockerfile in the Typemill repo and is this behavior reproducable? I will try the dockerversion in the next days