in reply to PDF to JPG for MySQL

As ww mentioned, this should work;

use Image::Magick::Thumbnail::PDF 'create_thumbnail'; my $abs_thumb = create_thumbnail('/home/myself/mypdfile.pdf');

If you have problems installing or trying it out, I can help you, I wrote the thing, PDF::OCR- I work with pdf/images a bunch at work.

My question is by golly why are you doing this... I mean.. I know you *can* .. but by Richard Stallman's beard oh why!!!

You're not gonna have a lot of records on this table are you? This could be a slow database or.. just huge.. if there are lot of records.

I would look into that if you haven't already. How it scales.. I suppose.

Replies are listed 'Best First'.
Re^2: PDF to JPG for MySQL
by scorpio17 (Canon) on Jun 26, 2008 at 16:13 UTC
    I agree. It's usually not a good idea to store actual FILES in a database (PDFs, images, movies, whatever). Instead, store the files in a secure data directory (i.e., not under your web root, if you want controlled access), then store the PATH in the database. When you need access, pull the path out of the DB, then fetch the file from that path, then stream it out to the client.
      Yeah, I mean... A database is a place where you want to store stuff that relates to itself somehow.. To each other, the records.. Like, you wanna see that the top 20 somethings are.

      You could save image metadata, pdf data, etc.. But the binary data???? (You know that pdfs can store thumbs inside themselves, right? You could code to make sure that such are present.. if not, make them and inject them into the pdf file )

      That's more what regular filesystems are for.

      Sure, a filesystem itself is a kind of database, it holds stuff - It's great if you know where the stuff is (the regular filesystem I mean ), but when you don't.. a database is great.

      Maybe rich731, you're trying to use the database server as a data server? Like, connect accross regular networks to ask 'site a' for thumbnail to 'file x' in 'site c' ?
      If so, there could be much better .. expedient ways to do that kind of thing. Like a gool ol' fashioned cgi.

        Thank you all for the advice. I think I'll take a second look at wether or not I am going to store binary data in the DB or not. I will try the Image::Magick::Thumbnail::PDF module as well as looking into the built in pdf thumbnails. I will post my results.

        Thanks,
        Rich


        P.S. "but by Richard Stallman's beard oh why!!!", very funny!!