kmachstang Posted October 16, 2007 Share Posted October 16, 2007 Hi All, I am currently working on a project where I must have a custom built PDF viewer that runs server side. The way I thought of doing it was to use the ImageMagick convert command to convert the page of the PDF that the user wants into a JPEG and serve that image. The problem is I can't have thousands of Image files hanging around on the server. Can anyone either: A) Tell me a better way of accomplishing what I need to do? B) Give me some clever idea as to how to create a dynamic image from the PDF file? C) Some idea as to how to delete the image after it is sent to the user? Any guidance will be greatly appreciated, Kyle Quote Link to comment https://forums.phpfreaks.com/topic/73505-solved-php-pdf-viewer/ Share on other sites More sharing options...
kpesanka Posted October 16, 2007 Share Posted October 16, 2007 How about just generating the way you suggest, and having a cron job run however often you'd like to clean up the directory of images? Quote Link to comment https://forums.phpfreaks.com/topic/73505-solved-php-pdf-viewer/#findComment-370917 Share on other sites More sharing options...
kmachstang Posted October 16, 2007 Author Share Posted October 16, 2007 That method was what I was planning on doing, but I was hoping for a better solution. I fear that someone could flood the site with requests in a short period of time causing the site to create thousands of images and filling the hard drive. Quote Link to comment https://forums.phpfreaks.com/topic/73505-solved-php-pdf-viewer/#findComment-371063 Share on other sites More sharing options...
MadTechie Posted October 16, 2007 Share Posted October 16, 2007 Script to check the creation time & date of the image files, over 2 days old get deleted.. either that or something like <?php header("Content-Type: image/jpeg"); //ImageMagick pdf to jpeg $img = imagecreatefromjpeg($imgname); imagejpeg($img); unlink($imgname); ?> Quote Link to comment https://forums.phpfreaks.com/topic/73505-solved-php-pdf-viewer/#findComment-371080 Share on other sites More sharing options...
BlueSkyIS Posted October 16, 2007 Share Posted October 16, 2007 i was thinking MadTechie's second suggestion: send the image to the browser without writing it to the drive. Quote Link to comment https://forums.phpfreaks.com/topic/73505-solved-php-pdf-viewer/#findComment-371081 Share on other sites More sharing options...
kmachstang Posted October 17, 2007 Author Share Posted October 17, 2007 Exactly What I was looking for, just wasn't sure how to handle it THANKS!!!! Quote Link to comment https://forums.phpfreaks.com/topic/73505-solved-php-pdf-viewer/#findComment-371305 Share on other sites More sharing options...
prime Posted October 17, 2007 Share Posted October 17, 2007 well thats not a matter of not saving it, unlink just deletes it after the browser has loaded it Quote Link to comment https://forums.phpfreaks.com/topic/73505-solved-php-pdf-viewer/#findComment-371357 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.