Re: Re: Imagemagick Displaying Images

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux