Re: Re: Imagemagick Displaying Images
| From: | Ray Hauge | Date: | Fri, 05 May 2006 00:57:26 +0000 |
| Subject: | Re: Re: Imagemagick Displaying Images | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235593@lists.php.net to get a copy of this message | ||
On Thursday 04 May 2006 17:52, Ray Hauge wrote:
> On Thursday 04 May 2006 17:41, Richard Lynch wrote:
> > [NB: Ray said that...]
> >
> > > It's easy if the image is all that is on the page.
> >
> > Errrr. HTML and in-line images don't really work in a cross-browser
> > compatible sort of way, and really mess with browser caching and page
> > load times and are just such a Bad Idea that I didn't even consider
> > that Ray might have meant "image inlined with HTML"
> >
> > I really (still) think Ray just meant:
> >
> > Cache and display the image in one operation without using a tempfile.
> >
> > Now that I think about it, you'd still want ob_start() if you want to
> > cache and display the image inlined with HTML anyway, assuming you
> > wanted to do something so foolish in the first place...
> >
> > --
> > Like Music?
> > http://l-i-e.com/artists.htm
>
> Here's what I ended up doing:
> <html>
> ...
> <img src='show_image.php?file=filename.pdf' />
> ...
> </html>
>
> where show_image.php contains:
>
> <?
> $path = "/path/to/files/";
> $filename = htmlentities($_GET['file']);
> $img = shell_exec("convert {$path}{$filename}[0] png:-");
> header("Content-type: image/png");
> print($img);
> ?>
>
> I could use a cache, but I haven't yet. It's for an internal intranet
> application, so I'm not worried about page load times too much. With 10
> pdfs it still loads in about a minute, and I don't expect there to be many
> more than 30 or so, and those PDFs will be moved after this application is
> run anyway, so caching doesn't make sense for my situation, as images will
> really only be shown once. If it was going to be used more caching would
> definitely make sense though.
>
> Thanks for the input all.
Basically I took the same principles applied to displaying images stored in a
database. I figured it was obvious that's what I was saying, but figured
clarification is always good.
--
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099