18590 Posts in 4875 Topics by 2285 members
General Questions
SilverStripe Forums » General Questions » Error with GD library?
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba
|
Page:
1
|
Go to End | |
| Author | Topic: | 1865 Views |
-
Error with GD library?

3 January 2010 at 9:26pm Last edited: 3 January 2010 9:28pm
I'm having an issue with uploading image in the backend of a silverstripe installation running on MAMP. This looks like an error creating the thumbnail image that is displayed when you pick an image in an ImageField.
As Im running on MAMP, gd should be up and running See Here.
Is this an error with GD? Or am I setting something up wrong on my page the PortfolioItem.php file is available here
Below is the error message that I get. There is an image attached to this post showing where the error occurs.
[Warning] imagecreatefrompng() [function.imagecreatefrompng]: gd-png: fatal libpng error: IDAT: CRC error
GET /portfoliotheme/images/iframe/PortfolioItem/12/PortfolioThumbnailLine 23 in /Applications/MAMP/htdocs/portfoliotheme/sapphire/filesystem/GD.php
Source14 // If we're working with image resampling, things could take a while. Bump up the time-limit
15 increase_time_limit_to(300);
16
17 if($filename) {
18 // We use getimagesize instead of extension checking, because sometimes extensions are wrong.
19 list($width, $height, $type, $attr) = getimagesize($filename);
20 switch($type) {
21 case 1: if(function_exists('imagecreatefromgif')) $this->setGD(imagecreatefromgif($filename)); break;
22 case 2: if(function_exists('imagecreatefromjpeg')) $this->setGD(imagecreatefromjpeg($filename)); break;
23 case 3: if(function_exists('imagecreatefrompng')) $this->setGD(imagecreatefrompng($filename)); break;
24 }
25 }
26
27 $this->quality = self::$default_quality;
28 parent::__construct();
29 }Trace
* imagecreatefrompng(../assets/Uploads/thumb4.png)
Line 23 of GD.php
* GD->__construct(../assets/Uploads/thumb4.png)
Line 297 of Image.php
* Image->generateFormattedImage(CMSThumbnail,,)
Line 264 of Image.php
* Image->getFormattedImage(CMSThumbnail)
Line 211 of Image.php
* Image->CMSThumbnail()
* call_user_func_array(Array,Array)
Line 408 of ViewableData.php
* ViewableData->XML_val(CMSThumbnail,,1)
Line 56 of .cache.Applications.MAMP.htdocs.portfoliotheme.sapphire.templates.Image_iframe.ss
* include(/private/var/folders/fX/fXEdSNLgECSQjs1HvnuQik+++TI/-Tmp-/silverstripe-cache-Applications-MAMP-htdocs-portfoliotheme/.cache.Applications.MAMP.htdocs.portfoliotheme.sapphire.templates.Image_iframe.ss)
Line 357 of SSViewer.php
* SSViewer->process(ViewableData_Customised)
Line 163 of Controller.php
* Controller->handleAction(HTTPRequest)
Line 129 of RequestHandler.php
* RequestHandler->handleRequest(HTTPRequest)
Line 119 of Controller.php
* Controller->handleRequest(HTTPRequest)
Line 277 of Director.php
* Director::handleRequest(HTTPRequest,Session)
Line 121 of Director.php
* Director::direct(/images/iframe/PortfolioItem/12/PortfolioThumbnail)
Line 118 of main.php -
Re: Error with GD library?

7 January 2010 at 5:07pm
I suggest you try to narrow the problem down by trying some image manipulation directly in PHP code, first using the Image class then with the GD library directly. Try to come up with the smallest amount of stuff (data, code, everything) involved in something that fails.
Toby
-
Re: Error with GD library?

22 April 2010 at 9:57pm Last edited: 22 April 2010 9:57pm
Check your permission of assets folder.
This fixed my similar issue, although Iv had lots of other permission trouble with WAMP/XAMP over permissions and couldn't direct you where to change it in MAMP.
Presuming your running a localhost version; I think there is a feature in 2.4 to 'detect new files' maybe you could get round uploading files by using that?
| 1865 Views | ||
|
Page:
1
|
Go to Top |

