0

I'm running Craft CMS on OS X Yosemite (Server.app) and cannot upload PNG images. JPG uploads are working as expected. I get a log message like the following:

2015/01/15 08:39:08 [error] [exception.Imagine\Exception\RuntimeException] exception 'Imagine\Exception\RuntimeException' with message 'Unable to open image .../craft/storage/runtime/temp/assets54b77cabe51c25.46473389.png' in .../craft/app/vendor/imagine/imagine/lib/Imagine/Gd/Imagine.php:96
Stack trace:
#0 /*/craft/app/etc/io/Image.php(136): Imagine\Gd\Imagine->open('...')
#1 /*/craft/app/services/ImagesService.php(84): Craft\Image->loadImage('...')
#2 /*/craft/app/services/ImagesService.php(153): Craft\ImagesService->loadImage('...')
#3 /*/craft/app/assetsourcetypes/BaseAssetSourceType.php(183): Craft\ImagesService->cleanImage('...')
#4 /*/craft/app/assetsourcetypes/BaseAssetSourceType.php(145): Craft\BaseAssetSourceType->insertFileByPath('...', Object(Craft\AssetFolderModel), 'HSS_Highlife_20...')
#5 /*/craft/app/services/AssetsService.php(673): Craft\BaseAssetSourceType->uploadFile(Object(Craft\AssetFolderModel))
#6 /*/craft/app/controllers/AssetsController.php(71): Craft\AssetsService->uploadFile('1', NULL, 0, NULL)
#7 /*/craft/app/framework/web/actions/CInlineAction.php(49): Craft\AssetsController->actionUploadFile()
#8 /*/craft/app/framework/web/CController.php(308): CInlineAction->runWithParams(Array)
#9 /*/craft/app/framework/web/CController.php(286): CController->runAction(Object(CInlineAction))
#10 /*/craft/app/framework/web/CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
#11 /*/craft/app/framework/web/CWebApplication.php(282): CController->run('uploadFile')
#12 /*/craft/app/etc/web/WebApp.php(754): CWebApplication->runController('assets/uploadFi...')
#13 /*/craft/app/etc/web/WebApp.php(261): Craft\WebApp->_processActionRequest()
#14 /*/craft/app/framework/base/CApplication.php(180): Craft\WebApp->processRequest()
#15 /*/craft/app/index.php(62): CApplication->run()
#16 /*/public/index.php(14): require_once('...')
#17 {main}
REQUEST_URI=/index.php?p=admin/actions/assets/uploadFile
HTTP_REFERER=http://*/index.php?p=admin/entries/banners/5-highlife-vanguard
---
2015/01/15 08:39:08 [error] [application] Unable to open image craft/storage/runtime/temp/assets54b77cabe51c25.46473389.png

It looks like a problem with the Imagine library not being able to open the uploaded PNGs?

3

Is there anything special about that PNG file? It's likely that it's in a PNG format that GD does not support.

Install Imagick and try again. It handles a much wider range of formats, is generally less buggy and produces better results. Craft will automatically use it if it detects that it is installed and available to PHP.

| improve this answer | |
  • 2
    They are Photoshop save for web PNGs. It looks like GD on Yosemite doesn't include PNG support. I used homebrew to brew install imagemagick and brew php55-imagick --without-homebrew-php. As you stated Craft picked up imagick (after adding the lib to PHPs config and restarting apache). Thx. – Matthew Abbott Jan 16 '15 at 12:39
  • Glad that was all it was! – Brad Bell Jan 16 '15 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.