picture from plugin folder with route

  • Hi Laurent,
    i have a problem with a plugin.
    I create temp pics to an folder of a plugin.
    This pictures should be available to the frontend. So i did add a route like this

    Code
    1. $this->routes = array(
    2. '/admin/mailgraph.php' => PLUGINS_PATH . '/' . $pluginName . '/frontend/mailgraph.php',
    3. '/admin/graph_postfix/mailgraph_day.png' => PLUGINS_PATH . '/' . $pluginName . '/tmp_graph/mailgraph_day.png'
    4. );


    If i click right on the pic and then on "Show picture" i got hieroglyphes

    Quote

    �PNG IHDR}Ia�bKGD������� IDATx��yxT���oB!l $c2c�®�&a�� H�ֵV��Ֆb�Y�օ�RM����A�� �i��bR�-�PH�d0�m&������>�o�[�̜�s��������|���ϝs?�}�DQ`ё6t!��Ɓu0���q`��#&�~عs�lK~~��Q��!**J�E"�NX���Qڈ� �Y>Pߑ�� '?????���+��]:(�-m��"��� O477�����������޽��^Իr���ƍ���q��\��T���Ǐ1◿��S�"�[6n�8|������ÇoڴIڸ{��s�&&&���k̘1�V�:�|d}�b�P��ɓ_|�E�>}Ə��W_ }z�ܹ˗/�m���[O�:��Դr��I�&�4��љ3g.��2�����^TTt뭷J��}��o����yꩧ�Ν{��i��)}�A���/���UVV���=��.��?��3�=��t{��y�b����7o�z����_|��ܹs}w�_��\.��N�����p�7o�5kV~�


    The picture itself is ok an will be correct openend if i use irfanview or another program.
    Now i testet that the perl script generates the pictures to the publich folder without any route and the picture appears in the browser without this hieroglyphs.


    Is there another way to bring this grafics to the frontend?

  • maybe you could specify a mime type when the header is sent? looks like it is sent as mime/text so the browser wants to show its source instead of render the image.


  • maybe you could specify a mime type when the header is sent? looks like it is sent as mime/text so the browser wants to show its source instead of render the image.


    That's correct.. But the problem only appears when i use the route functions of the plugin system.
    I don't know how i can add the mime types with this system.. That's not clear for me


  • Ok... I did it with a php script and the function imagecreatefrompng...
    This works... It seems that it is noch possible to use the route with pictures


    Hello ;


    When you are talking about picture, does you mean a way for a plugin to provide its own assets (images, css, js)?


    Well, the plugin bootstrap (gui/plugins.php) was not intended to expose that kind of resources. I've already planned to add an assets manager to allow such a thing.


    Edit: It seem that you are trying to publish an image builded by a script. I'll try something.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

    Edited once, last by Nuxwin ().