[SOLVED] CI 3.1.0 ImageMagick not working |
07-27-2016, 11:38 AM
(This post was last modified: 07-29-2016, 09:22 PM by John_Betong. Edit Reason: formatting and closing if statement )
Platform: Ubuntu 16.0.4.1
CI Ver: 3.1.0 Can someone please check the following: file: system/libraries/Image_lib.php PHP Code: // __LINE__ 890 I was also unable to get ImageMagick working in previous versions and had to use PHP exec('convert'... );
07-27-2016, 10:12 PM
(This post was last modified: 07-27-2016, 10:13 PM by John_Betong. Edit Reason: removed extra clsoing bracket )
OK, further experimentation and managed a very quick solution:
file: /CodeIgniter-3.1.0/system/libraries/Image_lib.php PHP Code: // line: 891
!!!! THANK YOU FOR POSTING THIS !!!!
Yes I am confirming this is absolutely true. The Image Library using ImageMagick (on a standard server) does not work without this fix, AND it returns an incorrect error message that the path is not set correctly. After many hours of frustration -- after applying this change -- everything worked perfectly. Betong can haz all the reputation points!
Haven't looked deep into this, but is this related to this?
https://github.com/bcit-ci/CodeIgniter/issues/4736
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
(08-24-2016, 02:58 AM)Narf Wrote:(08-23-2016, 04:00 PM)cartalot Wrote: The server is Linux Apache running PHP 5.6 Ok then lets download and try the official 3.1.0 link from the home page and use that system. And it does not work. It gives the error message that the path to the image library is not correct. Then lets download the 3.1 'stable' branch from Github and use that system. And that version does not even do the upload and it does not return any errors - it just gives a white screen. That situation is why earlier this month I started using 3.2.0 dev because it does not have the upload issue. So again the only fix i found that did work for getting ImageMagick to work was what was posted above by John Betong. And going into more details for anyone that is interested - the reason that I had to switch over to ImageMagick is that GD2 - which is the default - does not convert PNG files to JPG. You can do 'new_image' and add the .jpg and it will look like everything is working, but its does not actually convert the file format and the images are huge file sizes.
I'm not using the codeigniter image manipulation library myself so I dont know if it can help you with the conversion. But it's so easy in regular php:
PHP Code: function png2jpg($originalFile, $outputFile, $quality) {
(08-24-2016, 08:17 PM)Diederik Wrote: I'm not using the codeigniter image manipulation library myself so I dont know if it can help you with the conversion. But it's so easy in regular php: I am using PHP to create a dynamic SVG chart and then using ImageMagick to convert the chart to PNG. The image can then easily be emailed. Is there a similar PHP conversion function?
GD2 has no support for SVG images, so you indeed need to use ImageMagik. You can try using the function below instead of the exec() approach.
PHP Code: function svg2png($originalFile, $outputFile, $width=800, $height=600) { |
Welcome Guest, Not a member yet? Register Sign In |