|
Posted by Erwin Moller on 01/30/07 11:19
Nick Wedd wrote:
> Maybe this isn't really a PHP problem. But it's possible that PHP has a
> good solution for it.
>
> I have a php page which collects some input from the user, constructs an
> image, and then displays it to the user. The line of php that does the
> actual presentation to the user is
> print "<a href='$string'><img src='$string' width=784 height=431
> border=0></a>\n";
> where $string is something like
> 'r.pl?ar=7;cl=10'
> so the user gets to see a (large) thumbnail, and can then click on it to
> see the full-sized version.
>
> (The actual nitty-gritty of the image creation is done in Perl not PHP.
> I wrote it before I became more familiar with PHP and learned that PHP
> uses the GD library. I could rewrite it into PHP if I have to.)
>
> My problem is that my code calls r.pl twice, to do the same thing: once
> when the page is created, and once when the user clicks on the image.
> This wastes quite a bit of cpu time on the server, and slows the
> response for the user. What I would prefer to do is call r.pl once, put
> the resulting image in some kind of temporary session-specific file on
> the server (or in its memory), and then use this temporary thing twice,
> in place of $string above. Is this somehow possible?
>
> Nick
Yes Nick,
Excactly as you described it it could be done.
Just search for image (in the functionsearch) at www.php.net and you'll find
plenty examples.
http://nl2.php.net/manual/en/ref.image.php
Many imagefunctions have the possibility to safe the image to a path or
serve them directly to the browser.
If you run into problems, just come back here.
Good luck,
Regards,
Erwin Moller
[Back to original message]
|