Closed venkytt closed 4 years ago
Do you have any warning appearing? (Check your logs)
Do you have php-gd
library installed?
Hi
Thanks for the prompt response!
Yes, GD is present. phpinfo confirms it, and it is enabled.
No, no errors/warnings in the logs. Error reporting is being logged... but no errors from the above scripts nor from the autoload included files
Do you see anything missing or incorrect in the above print_r result please? Is it what you are expecting?
Thanks again
Does it works if you use save('out.jpg')
instead of output()
?
On the following code,
ini_set('display_errors', 1);
error_reporting(E_ALL);
include_once("vendor/autoload.php");
use Gregwar\Captcha\CaptchaBuilder;
use Gregwar\Captcha\PhraseBuilder;
$phraseBuilder = new PhraseBuilder(5, '0123456789');
$captcha = new CaptchaBuilder(null, $phraseBuilder);
$captcha->build();
//header('Content-type: image/jpeg');
$captcha->output();
Note: i have left out the header stuff just to see what i get...
����JFIF``��;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 90 ��C ��C ��(�"�� ���}!1AQa"q2���#B��R��$3br� %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������� ���w!1AQaq"2�B���� #3R�br� $4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������?����+�� (�� ���xxkϢj)��56��[' 1��l~�?���6�� �d�O�~+N��|��]F�<�ePc�'��*]�_���1�n|���<�������-#G��Q��$��ۡg��@��}9�o�����2��\�%�ԭ|���c����H�����vO��%?dϏ��gO��\������>A��K�9��£u����e��;��_�_�5�[�&���n����uuo �XɊY���ǖ��k[��(���j(���?0��#�]�τ�'����x_M����´�H��3̲�b/R ��zj�>���߱7���r sN���O��so���a�+�ی��φ��������w�����"��rh��ʈ�o1���l��n����?k߈���o���F��#C�-���R�Y�bIߒ�gqԔ�9��9(Ӷ����Ş������M�AԐn6����&ܐ*ppG�gi�mޱ����׳��kh̒HǢ��I>¿E��F��������ě;9<_���3^�����'�T ���n v�|m]�4d�h�~�~%��z~��{�
��|Yd��G�$(�Y�<�1�����v�8̶���W�-���X��'���˩xĶ)y:[[�����3��s��z���ψ���?����A�� \h:f�"�ln�J\�$ �.�i�2� ��W����LZ|ֵ�'F��ּ)��?u���d[Ayv\��"l��@���ď�H�%����ٵ��(�h�D��� � H��y�|���� ���|O�N����Q�j��g��Mʻ�P� 0� #�M}�9�����!�kZ��^'���+C��}2]���<|���e��I#p��N}<���.��8�I?x�����d�w�oxV)>�&��ϧ#����?�+���)�<5��ᗃm�h��ƍ�V(DC?��˾~�����x���f�����/���Ld�|�@m��I��e��=+���+�P���E�[�7~ M��Ҭ�7��T{�\���n�L�6r�ץJ�ҵ���?�5��<�?:>|1��O[xk���7w��eq#$��%~���=$�F�gx��<�O�� xH��|w~�s���n���H� ?.rı�O��g�S���f�g��to��^j��G�u��Ubd=77�t1��/����y/��}v�\�֒�}}$�l�V}�ȥC� �������n�U�E������&�yUMI���[Ƕ��&���'�» /�;}ol�Sqgl#�:L�]��c����?b� ��v���Um?��pֱ-��$�*33�\H�lc$�|��W�߾,�����o�z��o�xb�U�`4���ғ@�b �s�h��L��1���C�~��j+�/!�O]��N9��NfrI�}Ӕ];�+��~��B�Q�Z������?g� �� ����msƾ&��m�8����ʦU�����#��<�O�=�� �����<#����4��W�>B�7���o��˱s��_!_~��mZ������-�ȴ1�G"��WX�C�sq����O����m��ū?�&�(�K���̊��R0q"�n��0
Ҝ���N��(?�]�o� �N�&������9�4k]2��X.t�{}:��H��,��Q�.FA��]���i�u�~�� 6�^��Y�1;H�F��[a�c=O0�=[���S�3�7]��;=CY�����܋��T�\��b 8c�rŽj�7+.����mN�m���}t?mO�>Ky��;�I�t���j��v�a$�D*�I�r�]۹�O���R|G�����tɥ�#I�e���Nު�ɍ�B�rpFMy5&���QE#P����ú��|1c����,Ѿx+P��}?U�����%T�P.���3~��QW��9�NP�Gf?g��c�����|w��5k����H�M�
��JR)�;�<Ȝ�*��/�me��C����-Zɶ�\j1°L�0�1� �U��G@QXFi�&�?�3����=�F��>�!��c���ψ���o�]X��vâ5�Y��{��=zW���^9��&�� &[ˁ-�7���첕U@{�Kz0�%p���Ƅ#���~.���߈g(�N��1lX�5mB[�ln��1ۜ��zW�~�2|'��T���`
Ok so you are indeed getting a jpeg file but the content of the file itself is blank
ou use
save('out.jpg')
i
Yes!!! Save works!!!
Hmmm.... the "temp/" directory: where does it have to be? Does it have to be in /vendor/gregwar/captcha/ ?
I suspect a permission issue
Are you using linux or windows?
(Check for trailing spaces ` before the PHP tag as well
<?php`, this can output an actual space and corrupt the jpg file)
GRRRRR... that was the culprit...
works well...
it'd be nice to have the usual php error of headers sent already...
Yes I would like to have it always by default as well :smile:
Hello guys
Autoload installed via composer... all is well. I also created a temp directory, writable in the same directory where the files of captcha are.
The result is a blank image :-(
The code is
When i uncomment the line starting with "echo", i get a blank image and the result of the print_r (the echo line) is as follows:
What am I doing wrong?