GD2/image_lib working on live website, but not on localhost (XAMPP) |
[eluser]shadowmanwkp[/eluser]
Hi there, I've been scouring the internet for an answer, but I just can't seem to find one. My problem is with a controller that uses img_lib's resize function. There's an existing website I'm working on that displays the images that go through img_lib properly, but when I look at them through localhost, they show up as broken images. If I use <img> tags to point directly to the images they work absolutely fine, only the images that get go through the controller get broken. Here's the code: Code: function resized() { Because the dev that made the website is gone, and I have no documentation, it took me a while to figure out the code: - There's a controller images.php with the function resized() - The images already exist and reside in <domain>/public/userfiles/images and its subfolders - The image paths are pulled from a database, which I have running locally. These paths are put into <img> tags in their respective views - I have no clue why 'public/' is concatenated in source_image, the dev might as well have put that part of the path in the database - All images that need to be resized have the following urls <domain>/images/resized/<width><height>/actual/path/to/file.jpg - The function looks at <width> and <height> and uses uri->segment in order to see the dimensions that need to be resized to - Because dynamic_output is on, there's no actual folder that points to the image, but you can fool the <img> tags so you do display an image (just stick them in the folder hierarchy the src attribute specifies) - It does not matter if I autoload image_lib, and call it through a different function (forgot the specifics...): I still get thrown an error - According to netbeans, $image_dimensions wasn't used anywhere, so I commented it out, didn't seem to affect anything Here's some more info using a non-existing image (if I use an existing one, the browser throws an error message because the image is broken): Example URL: http://<local domain>/images/resized/150/300/userfiles/images/products/asdf.jpg Code: echo $irrelevant_part_of_uri: /images/resized/150/300/ And for good measure my operating system and software versions: OS: Windows 8 pro - 64-bit XAMPP 1.8.3 Codeigniter version: 1.7.3 Any help would be greatly appreciated!
[eluser]Flemming[/eluser]
hey, did you find the solution? Could it be that GD Lib isn't installed in XAMPP ?
[eluser]shadowmanwkp[/eluser]
[quote author="Flemming" date="1409587227"]hey, did you find the solution? Could it be that GD Lib isn't installed in XAMPP ? [/quote] GD2 is installed with every XAMPP, the only thing you have to do in order to activate GD2 is uncomment some lines in the php.ini. In fact the phpinfo() I shared says that it is enabled and installed: Code: gd The problem still persists though, I now have put it on a separate live domain for testing where it works a-ok, it's just that either XAMPP, or codeigniter does not like running GD2 in a local environment.
[eluser]Flemming[/eluser]
but what is this referring to in your OP ? Code: Your server does not support the GD function required to process this type of image. sorry, am not a XAMPP user so was just taking a stab in the dark! :-)
[eluser]InsiteFX[/eluser]
Make sure you also have php5 imagemagick installed, not just GD2 For some reason they do not mention this.
[eluser]shadowmanwkp[/eluser]
[quote author="Flemming" date="1409596866"]but what is this referring to in your OP ? Code: Your server does not support the GD function required to process this type of image. sorry, am not a XAMPP user so was just taking a stab in the dark! :-) [/quote] To me, that seems like a more generic error. Keep in mind that the image I'm using does not exist. If I did use a proper image, the browser would dump the error information into the image itself causing an error, with no way for me to read back the information I dumped. [quote author="InsiteFX" date="1409608793"]Make sure you also have php5 imagemagick installed, not just GD2 For some reason they do not mention this. [/quote] Either I'm doing something wrong, or imagemagick refuses to work properly. I installed "ImageMagick-6.6.7-5-Q16-windows-dll.exe" on the computer and put the imagick dll in xampp's ext folder. After that I edited the php.ini to include php_imagick.dll, but it refuses to resize the image: the browser still shows dummy images. I uninstalled imagemagick and instead of choosing program files (x86)/imagemagick, I chose c:/imagemagick, but to no avail. According to the phpinfo() at least imagick should work: Code: imagick However if I look at "environment" table of phpinfo(), it could be that it looks in the wrong folder, because the environment table contains both the old and the new path to imagemagick: Code: Environment Note: the imagemagick folder in program files does not exist anymore.
[eluser]InsiteFX[/eluser]
Question? What OS are you running and if using xampp where did you install it to? Ok, I see that you are running xampp. Xampp needs to be installed in the c:\ root not under Program Files (x86) Xampp has problems if it is not installed in the c:\ root on Windows OS. c:\xampp Thats where it should be if your running on Windows, also if you place it in the root like above I can explain to you how to setup the Windows environment variables for it.
[eluser]shadowmanwkp[/eluser]
[quote author="InsiteFX" date="1409733588"]Question? What OS are you running and if using xampp where did you install it to? Ok, I see that you are running xampp. Xampp needs to be installed in the c:\ root not under Program Files (x86) Xampp has problems if it is not installed in the c:\ root on Windows OS. c:\xampp Thats where it should be if your running on Windows, also if you place it in the root like above I can explain to you how to setup the Windows environment variables for it. [/quote] Already installed to c:\xampp, I've heard many problems about running it from x86 program files, especially on x64 vista systems and newer due to UAC. The operating system is windows 8 pro 64-bit (6.2 build 9200).
[eluser]avenirer[/eluser]
I don't know if this helps you... https://community.apachefriends.org/f/vi...17&t=53258 I think they are talking about Xampp 1.8.3
[eluser]InsiteFX[/eluser]
Setting Windows Environment varables: Code: 1) Windows Control Panel If you still cannot get it working I have an image library here that someone on here wrote that uses the CI Image_lib |
Welcome Guest, Not a member yet? Register Sign In |