Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

[Warning] imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions


Go to End
Reply

10 Posts   12588 Views

Avatar
juandavidgc

7 July 2009 at 2:09am Community Member, 36 Posts

Hey! good morning everybody!

I have been installed the image_gallery module, but i have a problem. In the section admin everything is fine, but in the public site, when i try to get into gallery page, i get this error:

[Warning] imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions
GET /galerias/?flush=1

Line 64 in /var/www/vhosts/mysite.com/httpdocs/sapphire/filesystem/GD.php
Source

55    /**
56     * Resize an image to cover the given width/height completely, and crop off any overhanging edges.
57     */
58    function croppedResize($width, $height) {
59       if(!$this->gd) return;
60       
61       $width = round($width);
62       $height = round($height);
63       
64       $newGD = imagecreatetruecolor($width, $height);
65       
66       // Preserves transparency between images
67       imagealphablending($newGD, false);
68       imagesavealpha($newGD, true);
69       
70       $destAR = $width / $height;

Anybody know what is the problem? Thanks!

Avatar
UncleCheese

7 July 2009 at 2:33am 4085 Posts

Make sure you have all the dimensions set in your ImageGalleryPage Configuration tab.

Avatar
juandavidgc

7 July 2009 at 2:43am Community Member, 36 Posts

Perfect!

That was the solution!

Thank you so much!

Avatar
vancouverWill

20 August 2009 at 6:25am Community Member, 121 Posts

I've had this problem, shouldn't this be validated on the form either frontend or backend to make it impossible for people to make mistakes. Lots of silverstripe projects customers have access to CMS so it is definitely a risk that they change the form and then it corrupts on the frontend of the site without them realising what they have done. I thought that I could just set one setting for the thumbnail and the other side would be worked out depeding on what the ratio of the photo size was.

This should ideally be set as standard, validation so that either neither height or width is set or that both are set.

Otherwise really great module and really impressed by what you have accomplished.

Cheers

Will

Avatar
UncleCheese

20 August 2009 at 6:44am 4085 Posts

I've since patched this bug so that 0 is never an accepted value for image size.

Avatar
sureshk

18 March 2010 at 12:47am (Last edited: 18 March 2010 1:02am), Community Member, 10 Posts

Hi UncleCheese,
I am getting this strange error for Image:

[Warning] imagejpeg() [function.imagejpeg]: Unable to open '../assets/Uploads/_resampled/CMSThumbnail-Building-HP-4.jpg' for writing
GET /images/iframe/HomepageSliderSlide/113/Photo

Line 397 in /var/www/vhosts/friendsofpubliced.org/httpdocs/sapphire/filesystem/GD.php
Source

388             case "gif": $type = 1; break;
389             case "jpeg": case "jpg": case "jpe": $type = 2; break;
390             default: $type = 3; break;
391          }
392          
393          // if the extension does not exist, the file will not be created!
394          
395          switch($type) {
396             case 1: imagegif($this->gd, $filename); break;
397             case 2: imagejpeg($this->gd, $filename, $this->quality); break;

Can you give me suggesstion how this error is rectified.
I increased the memory size to 128MB using this code "ini_set('memory_limit', '128M');" in mysite/_config.php file.
But It is not giving the solution for this error.

I am not getting this error in my localhost with the same server copy. This error is coming in Production server only.

Avatar
UncleCheese

18 March 2010 at 2:36am 4085 Posts

Can you give me some context? Is this the ImageGallery module? What are you trying to do?

Avatar
sureshk

18 March 2010 at 6:03am Community Member, 10 Posts

It is coming in ImageGallery module, for "cover Image " under Albums tab.
This same error also coming in another Page used for Homepage slide shows .
class HomepageSlider extends Page {
   static $defaults = array(
      'HideInSitemap' => '1',
      'ShowInMenus' =>'0',
   );
   
   static $allowed_children = array(
      'HomepageSliderSlide'
   );

and

class HomepageSliderSlide extends Page {
   static $defaults = array(
      'HideInSitemap' => '1',
      'ShowInMenus' =>'0',
   );
   
   static $db = array();
   
   static $has_one = array(
      'Photo' => 'Image'
   );

Go to Top