#native_company# #native_desc#

ImageMagick & safe_mode

By Tuin
on September 23, 2002

Well last week I had this problem resizing images with my Administration system ’cause my “server provider” refused to install gd2 and safe_mode = on.

They did want to install ImageMagick so I looked @ perl but I found the following solution for PHP.

Go to you php.ini and activate :

safe_mode_exec_dir = /some/path/to/dir

After setting up the directory take the following step :

cp /usr/local/bin/mogrify /some/path/to/dir

Set the User and Group to the “webuser” and do “chmod -R 711 /some/path/to/dir” to protect it from users who are not allowed to know 😉 .

Done this ? Then you can use the following line (well at least I did :)) :

system("mogrify -resize ".$w."x".$h." ".$the_file." ");

This should do it or just get you started !