Welcome to Geeklog, Anonymous Sunday, June 15 2025 @ 08:40 pm EDT

Geeklog Forums

another imagmagick problem


shaft

Anonymous
sorry guys,

ive thread through alot of threads on imagemagick and the various problems relating to it, but i cant get mine working no matter what i do. Banging your head

the code:

Text Formatted Code
$_CONF['image_lib'] = 'imagemagick'; // can be one of 'netpbm', 'imagemagick', 'gdlib'
 


Text Formatted Code
$_CONF['path_to_mogrify']       = 'C:/Web sites/ImageMagick/mogrify.exe';
 


Text Formatted Code
$_CONF['keep_unscaled_image']   = 1; // 1 = keep original images
 


Text Formatted Code
// Story image settings
$_CONF['max_image_width']       = 160;  // In pixels
$_CONF['max_image_height']      = 120;  // In pixels
$_CONF['max_image_size']        = 1048576; // 1048576 = 1MB
 


now according to everything ive read that should work. well, it actually does work. but it doesnt actually resize the image. log file:

Text Formatted Code
4/30/2005 4:16:31 AM - Debug: File size for evo 9.jpg is 89719 bytes
4/30/2005 4:16:31 AM - Debug: File, evo 9.jpg is of mime type image/jpeg and IS an image file.
4/30/2005 4:16:31 AM - Debug: in _getImageDimensions I got a width of 800, and a height of 524
4/30/2005 4:16:31 AM - Debug: Max allowed width = 160, Image width = 800
4/30/2005 4:16:31 AM - Debug: Max allowed height = 120, Image height = 524
4/30/2005 4:16:31 AM - Debug: File, evo 9.jpg has a width of 800 and a height of 524
4/30/2005 4:16:31 AM - Debug: File, evo 9.jpg is of mime type image/jpeg and IS an image file.
4/30/2005 4:16:31 AM - Debug: in _getImageDimensions I got a width of 800, and a height of 524
4/30/2005 4:16:31 AM - Debug: Max allowed width = 160, Image width = 800
4/30/2005 4:16:31 AM - Debug: Max allowed height = 120, Image height = 524
4/30/2005 4:16:31 AM - Debug: File, evo 9.jpg has a width of 800 and a height of 524
4/30/2005 4:16:31 AM - Debug: in _getImageDimensions I got a width of 800, and a height of 524
4/30/2005 4:16:31 AM - Debug: Going to resize image to 160x104 using imagemagick
4/30/2005 4:16:31 AM - Debug: Attempting to resize with this command (imagemagick): C:/Web sites/ImageMagick/mogrify.exe/ -resize 160x104 "C:/Web Sites/noob/images/articles/2005043004161551_1.jpg" 2>&1
4/30/2005 4:16:31 AM - Debug: Image, evo 9.jpg was resized from 800x524 to 160x104
 


if i browse on over to C:/Web Sites/noob/images/articles/ there is two image files. 2005043004161551_1.jpg and 2005043004161551_1_original.jpg. but they are both the same picture, same file size and same dimensions. i have no idea what im doing wrong...HELP!

the only thing i can think of is permissions, but the website account has read and execute access on the imagemagick folder. so it technically works, it just doesnt resize the image even though the log file says it did.

any thoughts?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
I see that you have ".../mogrify.exe/" there, i.e. there's a slash after the .exe (in your config.php). Try removing it.

bye, Dirk
 Quote

shaft

Anonymous
yeah sorry, the log file was an older one. i tried it with the / to see if it would work. but it doesnt.

its currently without a slash and still not working Sad

dunno what im doing wrong Can someone help me
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
If you can, try executing that line from the log on the command line and see what happens.

bye, Dirk
 Quote

shaft

Anonymous
hmmm, im using win2k3.. not sure if thats important Wink

anyways, i can run the mogrify command from anywhere because its in the path system variable in windows.

i go into my command line tool, type in:
Text Formatted Code
mogrify -resize 160x104 "C:/Web Sites/noob/images/articles/2005043004161551_1.jpg" 2>&1
 

and it works, resizes the image to a nice thumbnail size. obviously it also works if i browse to the imagemagick directyory and run the command from there

it doesnt work if i try to use the whole line:
Text Formatted Code
C:\Web sites\ImageMagick\mogrify.exe -resize 160x104 "C:/Web Sites/noob/images/articles/2005043004161551_1.jpg" 2>&1
 

i also tried putting a cd in front of it.

also tried using just mogrify in the config instead of the complete path:
Text Formatted Code
$_CONF['path_to_mogrify']       = 'mogrify.exe';
 


and also i tried swapping the slashes:
Text Formatted Code
$_CONF['path_to_mogrify']       = 'C:\Web sites\ImageMagick\mogrify.exe';
 


as you can see things are getting desperate Very Happy

im completly lost Sad
 Quote

shaft

Anonymous
anyone? praying it will work
 Quote

shaft

Anonymous
went looking around again... does it have something to do with the quotes in upload.class.php:

Text Formatted Code
$cmd = $this->_pathToMogrify . ' -resize '. $newsize . ' "' . $this->_fileUploadDirectory . '/' . $this->_getDestinationName() . '" 2>&1';
 


as discussed here and here

im not sure since the code is different in those examples from the code i have
 Quote

shaft

Anonymous
rah! i dunno whats going on...

so i tried using netpbm (downloaded "netpbm_gallery-1.4-pl2-win32" from sourceforge.net/projects/gallery) and this doesnt work either

i get this error:

Text Formatted Code
Couldn't copy C:/Web Sites/noob/images/articles/tmp.jpg to C:/Web Sites/noob/images/articles/20050503160427439_1.jpg. You'll need remove both files
 


the log file:

Text Formatted Code
5/3/2005 4:04:43 PM - Debug: File size for evo 9.jpg is 89719 bytes
5/3/2005 4:04:43 PM - Debug: File, evo 9.jpg is of mime type image/jpeg and IS an image file.
5/3/2005 4:04:43 PM - Debug: in _getImageDimensions I got a width of 800, and a height of 524
5/3/2005 4:04:43 PM - Debug: Max allowed width = 160, Image width = 800
5/3/2005 4:04:43 PM - Debug: Max allowed height = 120, Image height = 524
5/3/2005 4:04:43 PM - Debug: File, evo 9.jpg has a width of 800 and a height of 524
5/3/2005 4:04:43 PM - Debug: File, evo 9.jpg is of mime type image/jpeg and IS an image file.
5/3/2005 4:04:43 PM - Debug: in _getImageDimensions I got a width of 800, and a height of 524
5/3/2005 4:04:43 PM - Debug: Max allowed width = 160, Image width = 800
5/3/2005 4:04:43 PM - Debug: Max allowed height = 120, Image height = 524
5/3/2005 4:04:43 PM - Debug: File, evo 9.jpg has a width of 800 and a height of 524
5/3/2005 4:04:43 PM - Debug: in _getImageDimensions I got a width of 800, and a height of 524
5/3/2005 4:04:43 PM - Debug: Going to resize image to 160x104 using netpbm
5/3/2005 4:04:43 PM - Debug: Attempting to resize with this command (netpbm): C:/Web Sites/geeklog/netpbm/jpegtopnm  'C:/Web Sites/noob/images/articles/20050503160427439_1.jpg' | C:/Web Sites/geeklog/netpbm/pnmscale -xsize=160 -ysize=104 | C:/Web Sites/geeklog/netpbm/pnmtojpeg > C:/Web Sites/noob/images/articles/tmp.jpg
5/3/2005 4:04:43 PM - Error: Couldn't copy C:/Web Sites/noob/images/articles/tmp.jpg to C:/Web Sites/noob/images/articles/20050503160427439_1.jpg.  You'll need remove both files
 


so both netpbm and imagemagick can resize the file, they just cant put it in the directory. ive given write and modify permission to the IUSER account so im pretty sure thats not the problem. i really need help guys, im losing hair over this! Evil or Very Mad
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
The problem may be with the space in your path to the mogrify / netpbm executables: C:/Web Sites/...

If you can not easily change that, try adding quotes around the path in the upload class:
Text Formatted Code
 $cmd = '"' . $this->_pathToMogrify . '" -resize '. $newsize . ' "' . $this->_fileUploadDirectory . '/' . $this->_getDestinationName() . '" 2>&1';
 

bye, Dirk
 Quote

shaft

Anonymous
Quote by Dirk: The problem may be with the space in your path to the mogrify / netpbm executables: C:/Web Sites/...

If you can not easily change that, try adding quotes around the path in the upload class:
Text Formatted Code
 $cmd = '"' . $this->_pathToMogrify . '" -resize '. $newsize . ' "' . $this->_fileUploadDirectory . '/' . $this->_getDestinationName() . '" 2>&1';

 

bye, Dirk


nope doesnt work either, ill have to try renaming the folder Confused

other then config.php do i have to change the path anywhere else? cause at the moment i cant even load the site Sad
 Quote

shaft

Anonymous
Shocked

well, i found the entry in lib_common for the path. i assume that it was only config.php and lib_common.php that had to have the path's changed, i renamed the folder WebSites....

it still doesnt work though, i even tried using your line of code with the quotation marks.

log:
Text Formatted Code
5/4/2005 3:36:01 PM - Debug: Going to resize image to 160x104 using imagemagick
5/4/2005 3:36:01 PM - Debug: Attempting to resize with this command (imagemagick): "C:/WebSites/ImageMagick/mogrify.exe" -resize 160x104 "C:/WebSites/noob/images/articles/20050504153545133_1.jpg"
5/4/2005 3:36:01 PM - Debug: Image, evo 9.jpg was resized from 800x524 to 160x104
 

i tried it with, and without (as in the code above) the "2>&1" bit at the end. i alse tried it with the original non quotes around the path in the upload class and with the quotes like you suggested.

also, i delete the story and make sure the images are deleted from the articles folder each time i test it... just to make sure that its not detecting those images.

Banging your head

dunno what else to do..
 Quote

shaft

Anonymous
in hindsight, i probably should have mentioned this before. but im using IIS 6.. is there something special that i have to do in iis to allow imagemagick to work?
 Quote

shaft

Anonymous
anyone got a solution? Crying or Very sad
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Sorry, I'm out of ideas. Surely, someone must have got this working on Windows?

bye, Dirk
 Quote

All times are EDT. The time is now 08:40 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content