Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: [Solved]: Trouble Getting ImageMagick Properly Configured  (Read 3909 times)

0 Members and 1 Guest are viewing this topic.

bgohsman

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 5
[Solved]: Trouble Getting ImageMagick Properly Configured
« on: June 19, 2008, 04:13:12 pm »

Greetings,

First, I did read actually the sticky about troubleshooting uploads (not skimmed, read the whole thing). I've also searched for the error(s) that I'm receiving and read the resulting threads. That actually told me exactly what my initial problem was. I had to request the server error logs from the host and that confirmed that GD was exceeding the allotted memory. And I've worked with the hosting provider from there on setting up ImageMagick.

I should also mention that I have installed this on a couple of other servers and it all works fine. So there is something different about this particular server environment that is tripping me up (not Coppermine). And I'm going in circles trying to figure out what.

At first, I was using the GD library, which actually works just fine on smaller files. So permissions and such don't appear to be an issue. Above a certain size, however, the image would exceed the 8MB of allotted memory on the server. So I switched to ImageMagick. However, that is failing at the moment and I'm sort of scratching my head as to why. I'm hoping someone will read this and say, "Oh, yeah. It's 'bleh'". Here is what I know:

I'm on a hosted, virtual server. ImageMagick is installed in /usr/bin. I tested this by logging in via SSH and issuing the following commands:

-bash-3.00$ whereis convert
convert: /usr/bin/convert /usr/share/man/man1/convert.1.gz
-bash-3.00$ /usr/bin/convert -version
Version: ImageMagick 6.0.7 03/28/08 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2004 ImageMagick Studio LLC

So I've set /usr/bin as the ImageMagic directory in the config section and chosen ImageMagick as the conversion method.

The larger file does get uploaded to the /albums/userpics/1000x directory using GD 2.x, but does not result in a "normal" or "thumb" version being created and generates the expected Internal Server Error. When ImageMagick is selected, the file doesn't even get uploaded. But at least I get a meaningful error from Coppermine (see below).

/albums is recursively set to 777
/includes is recursively set to 777

Max upload size for this web server is 2048. Set as same in config.
Max width or height for uploaded pictures: 3072
Memory limit is 8MB (which was the problem GD 2.x was running into).
Testing a 1,003KB JPG that is 3,072 pixels wide at 72dpi.

The gallery URL is:
http://www.tek-creations.com/gallery

I have setup a test user as per the sticky:
Username: test
Password: test

Debug mode is on.

No. of boxes: fixed
File upload boxes: 1
URI upload boxes: 0

All permissions granted without approval.

The following error is generated after upload:
-----------------------------------------------
The file 'albums/userpics/10002/large_test.jpg' can't be inserted in the album

Error executing ImageMagick - Return value: 127

Cmd line :
/usr/bin/convert -quality 80 -antialias -geometry 100x66 'albums/userpics/10002/large_test.jpg' 'albums/userpics/10002/thumb_large_test.jpg'


The convert program said:


File: /vservers/tekcreat/htdocs/gallery/db_input.php - Line: 402


Debug info:
-----------------------------------------------
USER:
------------------
Array
(
    [ID] => 2dbaa9713c8a5cd66746c09f746ef894
    [am] => 1
    [lang] => english
    [liv] => Array
        (
        )

)

==========================
USER DATA:
------------------
Array
(
    [user_id] => 2
    [user_name] => test
    [groups] => Array
        (
           
  • => 2

        )

    [disk_max] => 0
    [disk_min] => 0
    [can_rate_pictures] => 1
    [can_send_ecards] => 1
    [ufc_max] => 0
    [ufc_min] => 0
    [custom_user_upload] => 0
    [num_file_upload] => 1
    [num_URI_upload] => 0
    [can_post_comments] => 1
    [can_upload_pictures] => 1
    [can_create_albums] => 1
    [has_admin_access] => 0
    [pub_upl_need_approval] => 0
    [priv_upl_need_approval] => 0
    [group_name] => Registered
    [upload_form_config] => 0
    [group_quota] => 0
    [can_see_all_albums] => 0
    [group_id] => 2
)

==========================
Queries:
------------------
Array
(
   
  • => SELECT extension, mime, content, player FROM cpg14x_filetypes; (0.002s)
  • [1] => select * from cpg14x_plugins order by priority asc; (0.001s)
        [2] => delete from `tekcreat`.cpg14x_sessions where time<1213879640 and remember=0; (0.001s)
        [3] => delete from `tekcreat`.cpg14x_sessions where time<1212673640; (0.001s)
        [4] => select user_id from `tekcreat`.cpg14x_sessions where session_id = 'c268ba41f45ea61f2be7441b6391ec2e' (0.001s)
        [5] => select user_id as id, user_password as password from `tekcreat`.cpg14x_users where user_id=2 (0.001s)
        [6] => SELECT u.user_id AS id, u.user_name AS username, u.user_password AS password, u.user_group+100 AS group_id FROM `tekcreat`.cpg14x_users AS u INNER JOIN `tekcreat`.cpg14x_usergroups AS g ON u.user_group=g.group_id WHERE u.user_id='2' (0.001s)
        [7] => SELECT user_group_list FROM `tekcreat`.cpg14x_users AS u WHERE user_id='2' and user_group_list <> ''; (0.001s)
        [8] => SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval FROM cpg14x_usergroups WHERE group_id in (2) (0.001s)
        [9] => SELECT group_name FROM  cpg14x_usergroups WHERE group_id= 2 (0.001s)
        [10] => update `tekcreat`.cpg14x_sessions set time='1213883240' where session_id = 'c268ba41f45ea61f2be7441b6391ec2e' (0.001s)
        [11] => SELECT user_favpics FROM cpg14x_favpics WHERE user_id = 2 (0.001s)
        [12] => DELETE FROM cpg14x_banned WHERE expiry < '2008-06-19 09:47:20' (0.001s)
        [13] => SELECT * FROM cpg14x_banned WHERE (ip_addr='24.231.255.8' OR ip_addr='24.231.255.8' OR user_id=2) AND brute_force=0 (0.001s)
        [14] => SELECT aid FROM cpg14x_albums WHERE visibility != '0' AND visibility !='10002' AND visibility NOT IN (2) (0.001s)
        [15] => SELECT category FROM cpg14x_albums WHERE aid='2' and (uploads = 'YES' OR category = '10002') (0.001s)
    )

    ==========================
    GET :
    ------------------
    Array
    (
    )

    ==========================
    POST :
    ------------------
    Array
    (
       
[album] => 2
    [MAX_FILE_SIZE] => 2097152
    [title] => Test image
    [caption] => Testing upload of 1,003KB image...
    [keywords] =>
    [event] => picture
)

==========================
Page generated in 0.098 seconds - 16 queries in 0.017 seconds - Album set : ; Meta set: ;
« Last Edit: June 20, 2008, 12:13:49 am by Nibbler »
Logged
Brandon Gohsman
EchoBox Interactive, LLC.

bgohsman

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 5
Re: Trouble Getting ImageMagick Properly Configured
« Reply #1 on: June 19, 2008, 04:20:38 pm »

One more interesting note:

I manually uploaded my large_test.jpg file to the /userpics/10002/ directory and then ran the following command in SSH:

-bash-3.00$ /usr/bin/convert -quality 80 -antialias -geometry 100x66 '/vservers/tekcreat/htdocs/gallery/albums/userpics/10002/large_test.jpg' '/vservers/tekcreat/htdocs/gallery/albums/userpics/10002/thumb_large_test.jpg'

It generated the thumbnail without issue. This leads me to believe that my problem has to do with uploading rather than ImageMagick. This is strange since uploading works when GD 2.x is selected.
Logged
Brandon Gohsman
EchoBox Interactive, LLC.

Nibbler

  • Guest
Re: Trouble Getting ImageMagick Properly Configured
« Reply #2 on: June 19, 2008, 05:00:16 pm »

Are you running apache chrooted or something?

See if this works:

Code: [Select]
<?php

var_dump
(file_exists('/usr/bin/convert'));

?>

Logged

bgohsman

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 5
Re: Trouble Getting ImageMagick Properly Configured
« Reply #3 on: June 19, 2008, 05:05:34 pm »

I ran that and received the following response:

bool(false)

I'm frankly not sure what that means, but it doesn't sound good. lol
Logged
Brandon Gohsman
EchoBox Interactive, LLC.

Nibbler

  • Guest
Re: Trouble Getting ImageMagick Properly Configured
« Reply #4 on: June 19, 2008, 05:11:18 pm »

It means it's not an uploading or even a Coppermine issue :)

Ask your host whether you are using chrooted apache if you don't know. Easiest thing would be to switch back to GD2 and just increase the memory limit.
Logged

bgohsman

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 5
Re: Trouble Getting ImageMagick Properly Configured
« Reply #5 on: June 19, 2008, 06:09:11 pm »

Will do. Back to the hosting provider. Thanks!
Logged
Brandon Gohsman
EchoBox Interactive, LLC.

bgohsman

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 5
Re: Trouble Getting ImageMagick Properly Configured
« Reply #6 on: June 19, 2008, 11:40:47 pm »

Solved! I heard back from the hosting provider and they had to make a change to the php.ini file. Everything is working flawlessly now. Hopefully, this post will help someone else with the same situation later.

Thanks for your help!

Brandon

Ref: tek-creations.com (H95138)
 
Hi, Brandon,

Since you're running your site in safe_mode, I've added safe_mode_exec_dir = /usr/bin to your php.ini so you can execute the /usr/bin/convert executable. file_exists will still return false for that though, as /usr/bin/ isn't in your open_basedir path (and it has not reason to be with safe_mode_exec_dir correctly set). You should now be able to call the /usr/bin/convert function without problem. Please ask if you need any further help though.

Regards,
******* 
Logged
Brandon Gohsman
EchoBox Interactive, LLC.

Nibbler

  • Guest
Re: [Solved]: Trouble Getting ImageMagick Properly Configured
« Reply #7 on: June 20, 2008, 12:14:05 am »

Great. Thanks for posting the solution.
Logged
Pages: [1]   Go Up
 

Page created in 0.027 seconds with 19 queries.