PHP Classes

Here can we decode JPG file?

Recommend this page to a friend!

      GIF images into animated GIF with native PHP class  >  All threads  >  Here can we decode JPG file?  >  (Un) Subscribe thread alerts  
Subject:Here can we decode JPG file?
Summary:want JPG file frame count...
Messages:9
Author:Avinash Pawar
Date:2008-09-24 12:18:47
Update:2008-10-20 05:18:12
 

  1. Here can we decode JPG file?   Reply   Report abuse  
Picture of Avinash Pawar Avinash Pawar - 2008-09-24 12:18:47
First of all thanks for your such g8 class..its working perfect...i am using this for frame count of GIF animation and wall but i want to use this for JPG contents also.so can please guide me...


Thanks Again..
mail id:prashant.b@mauj.com

  2. Re: Here can we decode JPG file?   Reply   Report abuse  
Picture of László Zsidi László Zsidi - 2008-09-24 21:22:35 - In reply to message 1 from Avinash Pawar
What did you mean under "g8"?
GIFEncoder or GIFDecoder class?

  3. Re: Here can we decode JPG file?   Reply   Report abuse  
Picture of Avinash Pawar Avinash Pawar - 2008-09-25 05:10:54 - In reply to message 2 from László Zsidi
Thanks for quick reply...actually g8 means "great"..
i used your GIFDecoder class file..so want to know, can we find JPG file frame count.as i tried to find out but not found exact solution..so Please guide me..Thanks again.



  4. Re: Here can we decode JPG file?   Reply   Report abuse  
Picture of László Zsidi László Zsidi - 2008-09-26 07:38:10 - In reply to message 3 from Avinash Pawar
If I understand correctly, do you want that the GIFDecoder output will be a counted jpeg frame?
In this cause I can you give a simple solution.

1.: Simple catch the GIFDecoder outuput format into an array
2.: Make image pointer from array /frame by frame/ by the imageCreateFromString or imageCreateFromGif functions.
3.: Put back frames into the array as a countered jpeg file such as:
for ($i = 0; $i < count ( $decoded_gif_array ); $i++ ) {
$tmp = imageCreateFromString ( $decoded_gif_array [ $i ] );
ob_start();
imageJpeg ($tmp);
$jpg = ob_get_contents ();
ob_end_clean();
fwrite(fopen("frame_$i.jpg","wb"),$jpg);
imagedestroy($tmp);
imagedestroy($jpg);
}

Thats all!

  5. Re: Here can we decode JPG file?   Reply   Report abuse  
Picture of Avinash Pawar Avinash Pawar - 2008-09-26 08:58:09 - In reply to message 4 from László Zsidi
I really thanks for your quick reply...
sorry to say, there is some misunderstanding...
as i want to find out JPG image(Wallpaper) frame count.

As i used your code for JPG image but it shows wrong frame count instead of showing 1 frame count.as Class is for GIF images only..GIG89a

But i want that i can given JPG image as a input and i should get frame count of that image through getFramecount function(your created function)...

I will also try for this...i think need to change image pointer here...something like this...

so please guide me...thanks a lot for your such quick support

  6. Re: Here can we decode JPG file?   Reply   Report abuse  
Picture of László Zsidi László Zsidi - 2008-09-26 20:17:42 - In reply to message 5 from Avinash Pawar
Are you sure that we are talking about my GIFDecoder class?
In the class there's no exists getFramecount function between public functions.

This version have two pulic functions such as: GIFGetFrames() and GIFGetDelays().
This class can be used do decode GIF images only, this class can't handle jpeg or other image type.
So, input parameter must be an amated GIF data pointer only...

  7. Re: Here can we decode JPG file?   Reply   Report abuse  
Picture of Avinash Pawar Avinash Pawar - 2008-09-27 05:00:27 - In reply to message 6 from László Zsidi
Thanks for reply...
sorry i written wrong function name....

you are right...

i am talking about your class...

i will try for JPG image...

Whatever, i like your written class its really good...thanks for support...

and if you find any solution for JPG images then please inform me i will be thankful to you........



  8. Re: Here can we decode JPG file?   Reply   Report abuse  
Picture of László Zsidi László Zsidi - 2008-10-19 20:12:30 - In reply to message 7 from Avinash Pawar
Jpeg formats cannot be used to create animation directly without transcoding into a GIF format.
Jpeg images can be used to create mjpeg /motion jpeg/ I was thinking i am going to create a dedicated class which can be used to build motion jpeg but it was difficult a bit.
Maybe in the future i am going to write a mjpeg class.

  9. Re: Here can we decode JPG file?   Reply   Report abuse  
Picture of Prashant Bhavsar Prashant Bhavsar - 2008-10-20 05:18:13 - In reply to message 8 from László Zsidi
Thanks for your valuable reply...
please let me know once you succeed in your mjpg class..and its really good to have motion jpeg...

i will also try to do some thing innovative..and i would like to share with you...