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 9225217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:31:21+00:00 2026-06-18T04:31:21+00:00

I use php and ghostscript to convert pdf to image and show <?php if(empty($_GET[‘page’]))

  • 0

I use php and ghostscript to convert pdf to image and show

<?php
if(empty($_GET['page'])) die;
$numPage=$_GET['page'];
header('Content-type:image/jpeg');
system("gs ".
"-dNOPAUSE ".
"-sDEVICE=jpeg ".
"-dFirstPage={$numPage} ".
"-dLastPage={$numPage} ".
"-sOutputFile=%stdout ".
"-dJPEGQ=90 ".
"-r100x100 ".
"-q file.pdf ".
"-c quit");
?>

thanks for your answers

  • 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-18T04:31:23+00:00Added an answer on June 18, 2026 at 4:31 am
    1. Use passthru instead of system
      According to PHP Manual This function[passthru()] should be used in place of exec() or system() when the output from the Unix command is binary data which needs to be passed directly back to the browser.

    2. change %stdout to -
      gs man page:

      You can also send output to stdout for piping with the switch

              -sOutputFile=-
      

    the code below should fix it.

    <?php
    
    if(empty($_GET['page'])) die;
    
    $numPage=$_GET['page'];
    
    header('Content-type:image/jpeg');
    
    passthru("gs ".
    "-dNOPAUSE ".
    "-sDEVICE=jpeg ".
    "-dFirstPage={$numPage} ".
    "-dLastPage={$numPage} ".
    "-sOutputFile=- ".
    "-dJPEGQ=90 ".
    "-r100x100 ".
    "-q file.pdf ".
    "-c quit");
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to do use php/regex to replace this: {{image-4-m}} to this: <img src=4.jpg
When i use php include to include a page in my website all the
I use PHP for creating a captcha image. It is showing the captcha at
I have tried to use php to caculate a image's avarage color. So I
I use php imagecolorallocate() and imagefill() in an image upload to also let png
How can I use PHP to show five rows from a MySQL database, then
use PHP and MySQL. Want my website to have the feature of image uploading
I use PHP and javascript via prototype. i have a threaded comments page that
I use php include() for my header, footer, navigation etc. I have the following
I use Ghostscript to strip images from PDF files into jpg and run Tesseract

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.