What about using a data url?

On Oct 15, 2008, at 8:17 AM, Massimiliano wrote:

>
> On 15 Ott, 13:08, "Ali B." <[EMAIL PROTECTED]> wrote:
>> 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.
>
> Because the <img> tag requires a URI in the src attribute. The
> original plugin constructs a $variable that is the link to the cached
> file. If I directly provide the $response variable, I'm providing the
> actual file (unless I'm missing something about RemoteRequest). In
> fact I get a string like
>
> ���t `�p41<�   ��tZ���  b#o$3Bz�aqe Yv@
> x    �1�)& '  '|$�) �
>
> If I simply return $response, I get a string like
>
> GIF89a)� �������������FFF���ttt\\ 
> \���   444      $$$   ������!
> �  ����,����)� �� � �A@   3 � �  
> G5�(�!I� � �  �Av
> |� �Ch�A,F ��p 6S��tJ%T   
> [EMAIL PROTECTED]"E&�>���t `�p41<�   ��tZ���   
> b#o
> $3Bz�aqe Yv@
> x    �1�)& '  '|$�) �;
>
> I can't think of other ways to return $response. BTW, now I'm using
> the condition that you suggested :)
>  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 / dmondarkhttp://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
-~----------~----~----~----~------~----~------~--~---

Reply via email to