{"issue":{"created_at":"2011-11-29T07:13:02Z","state":"open","updated_at":"2011-11-29T07:13:03Z","user":{"gravatar_id":"256406243346b9253f8610fb1d1e05f6","id":1215373,"url":"https://api.github.com/users/importer","avatar_url":"https://secure.gravatar.com/avatar/256406243346b9253f8610fb1d1e05f6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"importer"},"comments":1,"body":"When using Typolight (2.7.3) on a system where the Safe Mode Hack is required, there is an issue with uploading images that exceed the \"max image size\" (not to be confused with \"max frontend image size\") which is configured in the backend of Typolight.\n\nThese images are automatically resized by Typolight during/after the upload, but even with enabled Safe Mode Hack and correct directory and file permissions it fails with the following error\n\n```\nWarning: imagejpeg() [function.imagejpeg]: Unable to open '/var/kunden/webs/webXYZ/tl_files/dasbild.jpg' for writing: Permission denied in /var/kunden/webs/webXYZ/system/libraries/Controller.php on line 800\n```\n\nThe issue is obviously caused because Apache runs as user www-data and the FTP user is different.\n\nThe issue is caused in row 800 in /system/libraries/Controller.php\n\n```\nimagejpeg($strNewImage, TL_ROOT . '/' . $strCacheName, (\n\n![]($GLOBALS['TL_CONFIG']['jpgQuality'] ? 80 : $GLOBALS['TL_CONFIG']['jpgQuality']));\n```\n\nI tried adding the following before this imagejpeg command:\n\n```\ntouch(TL_ROOT . '/' . $strCacheName);\n```\n\nbut my touch also failed with the following error:\n\n```\nWarning: touch() [function.touch]: Utime failed: Operation not permitted in /var/kunden/webs/webXYZ/system/libraries/Controller.php on line 800\n```\n\nI guess that the Safe Mode Hack don't addresses the resize functions and we have to do some magic BEFORE modifying the images in order to fix this issue.\n\nby the way, this is the output from the safe mode hack testing tool out of the typolight repository (just to show that my config is ok):\n\n```\nSystem temporary dir: \nChecking tmpfile() ... success)\nCreating TYPOlight temporary file system/tmp/d3380ed510f1989849f2bdf9e43d611d ... success\n\n![](\nConnecting to FTP server ... success)\nLogin with FTP username and password to server ... success\n\n![](\nCheck for correct directory ... success)\nUpload file smhcheck.dat ... success\n\n![](\nCheck file smhcheck.dat ... success)\nDelete file smhcheck.dat ... success\n\n![](\nCreate directory smhcheck.dir ... success)\nDelete directory smhcheck.dir ... success\n\n![](\nDelete TYPOlight temporary file system/tmp/d3380ed510f1989849f2bdf9e43d611d ... success)\nSafe Mode Hack is enabled and appears to be working.\n```\n\nJust as a reference:\nI initially reported this issue here:\nhttp://www.typolight-community.de/showpost.php?p=15382&postcount=13\n\n[Download the attachments](http://www.contao.org/tl_files/tickets/1016.zip \"Download the attachments of this ticket\")\nRelated issues: #1235, #1919\n\n--- _Originally created by enemours on September 20th, 2009, at 10:27am (ID 1016)_","assignee":{"gravatar_id":"87d2e5aefadcb310f9155df28c2b3582","id":1192057,"url":"https://api.github.com/users/leofeyer","avatar_url":"https://secure.gravatar.com/avatar/87d2e5aefadcb310f9155df28c2b3582?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"leofeyer"},"id":2379559,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"labels":[{"name":"Defect","color":"bd2c00","url":"https://api.github.com/repos/contao/test/labels/Defect"},{"name":"framework","color":"e6e6e6","url":"https://api.github.com/repos/contao/test/labels/framework"}],"number":1016,"title":"Safe Mode Hack don't addresses Image Resize Functions (imagejpeg() Errors during Upload)","closed_at":null,"html_url":"https://github.com/contao/test/issues/1016","url":"https://api.github.com/repos/contao/test/issues/1016","milestone":{"created_at":"2011-11-29T05:26:46Z","state":"open","closed_issues":15,"due_on":null,"creator":{"gravatar_id":"87d2e5aefadcb310f9155df28c2b3582","id":1192057,"url":"https://api.github.com/users/leofeyer","avatar_url":"https://secure.gravatar.com/avatar/87d2e5aefadcb310f9155df28c2b3582?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"leofeyer"},"number":14,"description":"TYPOlight 2.7.4 (maintenance release)","title":"2.7.4","open_issues":1,"url":"https://api.github.com/repos/contao/test/milestones/14"}},"action":"opened"}