4

I have having problems getting a crop to work on an image (I have got the resize working fine)

The orginal image is x and after a resize:

mogrify -resize x75 /my/path/image.jpg

i can see the resize has worked properly after performing getimagesize():

Array
(
    [0] => 148
    [1] => 75
    [2] => 2
    [3] => width="148" height="75"
    [bits] => 8
    [channels] => 3
    [mime] => image/jpeg
)

the crop command is:

mogrify -crop 100x75! +0+0 /my/path/image.jpg

Once this is complete I try and confirm the image is the correct size by using getimagesize() but i get the following error and I also can't access the image.

Warning (2): getimagesize(/my/path/image.jpg) [function.getimagesize]: failed to open stream: No such file or directory

Any ideas? Am i using the wrong syntax for the crop?

Thanks in advance!

Lizard
  • 43,732
  • 39
  • 106
  • 167

2 Answers2

5

Looks like the error was in the syntax there is no space between the image size and crop position. it should look like this:

mogrify -crop 100x75!+0+0 /my/path/image.jpg

the below is incorrect:

mogrify -crop 100x75! +0+0 /my/path/image.jpg
Lizard
  • 43,732
  • 39
  • 106
  • 167
0

I can't remember which path I used previously but I found that the only way I could get the image size was to use a direct link to the file http://www.blablabla - Have you done that or are you using the PHP path?

On a sidenote I thought you were meant to set the filename twice for it to open and then save the file?

mogrify -crop 100x75! +0+0 /my/path/image.jpg /my/path/image.jpg

I hope this helps you out mate...

Jon
  • 23
  • 5