Recommend this page to a friend! |
GIF images into animated GIF with native PHP class | > | All threads | > | Error creating a GIF | > | (Un) Subscribe thread alerts |
|
![]() hi anyone
szia László little problem for me... i'm trying to create an animated gif with some non-animated gif i have some gif into $path directory: 0.gif 1.gif 2.gif 3.gif... this is how i make the array[]: if ($dh=opendir($path)){ for ($i=0;$i<$counter;$i++){ $frames[$i]=$path. $i . ".gif"; $framed[$i]=100; echo"Slide[$i]=$frames[$i]-Framed[$i]=$framed[$i]<br>"; } closedir($dh); } i think this is correct, and so, now i create the gif $gif = new GIFEncoder ( $frames, $framed, 0, 2, 0, 0, 0, "url" ); than... echo $gif->GetAnimation( ); so... why when i create the gif this is what it returns to me? GIF89a2�2����hvTt"$:< tD!����J�qB���������DV4���$! ������]%����nD ���>M.������{O,��T�\5x1 ���0 �`������@@"�.^�h<_0��� Q$)$0 ��j���2<.i<����iP�D' ъg%(gY7�]>P0 l/�U0�P0�244!N 4�Ҵ�U"�~Lɬ�LL4�����dčp.�\�"�2$���T0$4"\=TbT�jDlf4��x������ܒ|���������\N<����zQ���̢l�iD�jDl�qĞ|���ttTTY9$" ��n������\D(�����l�jHQ׆_�vTԮ�44 �z\L �b?6xJ |b<���)6DR,D6|V46?F(`6�V!����b@L6�ƴ�V1Ɇ\�b<Ԟt�vT�X����"L6�rO���v/������'���܂d�nPa*���'�|`6�p��|D6_jL̆d��`Ԟ�t*l64B@*4����V"���H^L�V< ���T<!�NETSCAPE2.0���!�d���,����2�2����Y�jA�E�`��Q2�R?hR��a `h((ٸQJ�v����1q��&t��$�@���R�/X�b��P�'�솰��F�F�{�ā�),߭z�� Ah��� ��-6�P�F[X4I$�d11 ՍG��`�C���pHy�N�*O�!�l;q3J�$EȞ)������x�C,3 E��i��U���v�V��3�^)�%já-�f9n`a_P��0�Ɩ>,Xx��B��I��خ�#����y R���_�HR�B�!0�X%�������4���4���X䱓BF�L� 8��B;� ��pI�SH�`�WD�;�)��C��v�G�p�M�����y�>�1��ڨbN1(��ԅ��"���`0$�������%�X�G^PB�F*�0��,8��W���q��Oq6�8�����/�q��!�� �␂�|�)âG>�\���h�'-z%G�N�颷4��w�(݄/�)�2ܒ��U��c��IA���;՝z% ����cJx���)T� �А+�e;}���!%�\ T1� `E-ü���/���*}hC�$�tA:�`��h�.��1�cR,���UT�K�Ͻ=�p.�Ꚅ;����|0"#� (Ӌ��̫����8�Xz�;��a�Fp���<��#�+]$S���s ��7S|:i�D*��s�T��������i�B����]��J����N�!i���381P@a�� =���ֻ��.K��y��N�IـPFe�8�\�O��1_l��j���5�h1I����ln�0���pQEA��E B�M��t�PC���?�/��\�uPS8K8s-7�F���3i̫��z�S�1ܲ�R�w�"�,2�+�T�C �B�a�^3�5Y8����Q7��y*z�*\4�;h�鈅/��� "�0(�0� D������,d�0�۲t�,"�K�>1 ID`�h��'T�N8 �Ae{r�!�P�n�VK��-�p�^�����A���x5� ��(� ��B-|�K���0A��� ԀP���C=����E�e*@�����S��?�� 8P ��0��+���:�^07d`)��&1 ct�����Đ�\��<�F"�! e���H�(C;� `�h��C v�Dx#B�*������;��HS'�E5�@#�����8Q�*<�Ü�z�2� q��ZPAz��A ,P�T��&ԣ� ��azl�~�j�;����x�����~JB�ȃ,�{�a˸ٰ'���^���7Up]��1�5X��ֹh#��E2�`��'2�3�Ѓ^��' � �!�c&q�F Ѐ ��Y6"�%�@yȃ2NЋ�&XѠȸ�B �H��Q$��2�� b@�Rz�M��AР�� �XD؀'�x� �`� ��]Փ��q�� ��h?�� I�A �����@�j�{�>8�y�)ސ�<��f=A�ц;h@�*���z���1�B��#!NF��C���@�Q�]D���?b�z4kO���P�T�HG8>�=�m�84a s�=� 6�F�i]�......................... and on... why? any idea? thanks a lot regards antonio
![]() Hmmm...it's very interesting:)
A way for a simplified solution is: <?php $path = "\images\frames\"; $f = array ( ); $t = array ( ); for ( $i = 0; $i < 5; $i++ ) { sprintf ( $f [ ], "%s%d.gif", $path, $i ); $t [ ] = 10; } /* older version */ $GIF = new GIFEncoder ( $f, $t, 0, 2, -1, -1, -1, "url" ); /* 3.0 version */ $GIF = new GIFEncoder ( $f, $t, 0, 2, -1, -1, -1, array ( ), "url" ); header ( 'Content-type:image/gif' ); echo $GIF->GetAnimation ( ); ?>
![]() szia laszlo
i'm still in troubles my gif files are in \new_img folder \new_img\0.gif \new_img\1.gif \new_img\2.gif ... this is my code: $path="new_img\\" $f = array ( ); $t = array ( ); for ( $i = 0; $i < $counter ; $i++ ) { $f [$i] = "$path$i.gif"; $t [$i] = 75; } $GIF = new GIFEncoder ( $f, $t, 0, 2, -1, -1, -1, "url" ); header ( 'Content-type:image/gif' ); echo $GIF->GetAnimation ( ); but i have this error code now: Warning: Cannot modify header information - headers already sent by (output started at C:\Programmi\Apache Software Foundation\Apache2.2\htdocs\php\make.php:9) in C:\Programmi\Apache Software Foundation\Apache2.2\htdocs\php\make.php on line 49 GIF89a; why?
![]() sorry once again...
but the warning is not the problem i edited with a notepad the frames you use in your Example.php those frames are all like this: GIF89aę < ÷ the gif i have to merge are all like this: GIF89a2 2 ç note that i created my gif with these php function: $tmpimg=imagecreatetruecolor(50,50); imagecopyresized($tmpimg,$srcimg,0,0,$x1,$y1,50,50,$src_w,$src_h); imagegif($tmpimg,$file2,80); so... fact is that my gif seems to be un-readable or incompatible with you GIFEncoder.class.php any suggest? thanks a lot
![]() Seems to be sent the html header multiple...
Review your code and search Header(); functions multiple. |
info at phpclasses dot org
.