Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7896799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:59:14+00:00 2026-06-03T07:59:14+00:00

I am creating a cron job in which I copy files from one directroy

  • 0

I am creating a cron job in which I copy files from one directroy to another. The cron job works fine it copies the files to the import directory. The structure of import directory is like this.

import
      folder1
          pdf_file1
      folder2
          pdf_file2

I am trying to create a thumbnail image for each pdf file that is copied to the folders, I installed ImageMagik and my php code to create a thumnail image is

 if ($preview != "") {
    $copy_res = ftp_get("files/upload/" . $ftp_upload["path"] . "/" . $preview, "files/import/" . $ftp_upload["preview"] . "/" . $preview);
    $md5_checksum = md5("files/import/" . $ftp_upload["path"] . "/" . $preview);
 } else {
         //$pdf_file = 'files/import/folder1/pdf_file1';
         $pdf_file = 'files/import/' . $ftp_upload["path"]."/".$filename_new;
         if (file_exists($pdf_file)){
             echo 'I am here';
             exec("convert -density 300 " . $pdf_file . "[0]" . $filename_new . ".jpg");
         }
 }

When I run the code it comes to the else statement and echo the line but its not executing the exec command.
I checked the convert command from Command Prompt for that I navigated to

 C:\wamp\www\project\files\import\folder1 

and then I run this command

 exec("convert -density 300  test.pdf[0]  test.jpg");

From the command prompt it worked but in my code it s not working .
Is there any issue with the path ? because the file is alreday copied when I try to create the thumbnail for it.

The ImageMagik is installed in

 C:\Program Files(x86)\ImageMagik

Any ideas what I am doing wron ? and is there any other faster way to create thumbail image for pdf ?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:59:15+00:00Added an answer on June 3, 2026 at 7:59 am

    There seems to be a missing space that separates the path to the pdf file and the new name for the image file.

    exec("convert -density 300 " . $pdf_file . "[0]" . $filename_new . ".jpg");
    

    Should be:

    exec("convert -density 300 " . $pdf_file . "[0] " . $filename_new . ".jpg");
    -----------------------------------------------^
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: PHP list all files in directory ive got a cron job running
I am creating a php script that would be called as a cron job.
I m creating cron job that takes backup of my entire DB. For that
I have a php script and using Cpanel interface Im creating a cron job
I am creating a bank simulation game and have the cron job working to
How can you do a cron job with php without creating a cron Job
Currently, I have one php function which is running with cron. It's the function
I've come across a checklist for creating a new PHP cron at my job
I'm creating a simple paste-bin in Ruby on Rails, which will have an expire-feature.
I'm creating a PHP website which involves users signing up, and I'm wondering about

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.