1

I have a command line that I run from a specific directory to resize images, but I now need it to run from a php script so I can put it into a cron job to automate. The command is mogrify -resize 800x800\> *.jpg. I'm only looking for help to set up the php script, as I'm novice to doing this. Thanks in advance.

1

1 Answer 1

3

Cron has nothing to do with php. Have you tried putting

cd "$whatever_directory" && mogrify -resize 800x800\> *.jpg

in cron?

That said, you can get php to execute shell commands with exec and shell_exec, but I would urge you to consider if that's what you want.

Sign up to request clarification or add additional context in comments.

2 Comments

I'm very new to doing even a basic script in php, so thank you for your response. ...and yes, I should have been a little clearer, I meant that this php script will later be put into a cron job. I will try your suggestion. Thanks
I'm glad I re-read your response to enter the code directly into cron. WORKED PERFECT and easier than expected! Thanks! I guess I didn't need to setup a php script file to call from. I am using ImageMagick on my server to process these images (I also had a misspelling: mogrify is the correct command wording I needed too)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.