Why would you want to retrieve the image directly from the cache folder? You
are already caching the response itself, so you can simply retrieve it.
Something to do would be like the following:
If Cache::set('latex_response') {
$response= Cache::get('latex_response');
}
else {
$request = new RemoteRequest( $generated_image );
$request->execute();
$response = $request->get_response_body();
}
// User the response variable here to construct the img tag... and proceed.
On Wed, Oct 15, 2008 at 10:47 AM, Massimiliano <
[EMAIL PROTECTED]> wrote:
>
> Hi. I'm trying to port a plugin from the Other Blog Engine to Habari.
> It enables LaTeX code into posts, so I think it won't be of any
> interest, except to fellow physicists. Anyway, I can't make my code
> work.
>
> http://pastoid.com/bcg
>
> Line 77 creates a LaTeX image with the help of a public server. If I
> put the generated URL into a post, it works. But I don't want to load
> the image and leech the server's bandwidth every time, so I need to
> grab the image and cache it.
> Lines 80-82 request the image with RemoteRequest and store the content
> in the variable $response. Then, lines 85-87 put $response into the
> cache. But I get this error:
>
> Warning: fopen(/user/cache/tex_c9faf6ead2cd2c2187bd943488de1d0a.png)
> [function.fopen]: failed to open stream: No such file or directory in
> user/plugins/latex/latex.plugin.php line 83
>
> I am a PHP newbie. The manual says that I need allow_url_fopen
> enabled: my hosting provider has disabled it. I don't know if it's the
> issue, but I need a workaround. So I substitute lines 85-87 with
>
> Cache::set( $cached_image, $response );
> $retrieved_image = Cache::get( $cached_image );
>
> and a file "foo.data" is created successfully in my cache.
> But now, how can I make transform this foo.data into an image, so that
> I can put it in my entry?
>
> Massimiliano
> (iMassimiliano on IRC)
> >
>
--
Ali B / dmondark
http://www.awhitebox.com
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/habari-users
-~----------~----~----~----~------~----~------~--~---