Problem wiht wrong file format (gif insted of jpg) when saving images from server - PHP -
I am using the peace of PHP code to save some images and rename.
foreach ($ & amp; $ value as phone $) {$ link_img = $ handle = @fopen ($ link_img, "r"); If ($ handle) {while ((handle $ FIFF) ($ buffer. = Fgets ($ handle, 4096);} Fclose ($ handle); $ filename = "files / Nokia _". $ Phone_model. " $ .jpg "; $ Mystring = fopen ($ filename," wb "); $ handle = fopen ($ filename," wb "); $ numbytes = fwrite ($ handle, $ buffer); fclose ($ handle); set Most images are JPGs, I think the extension is .jpg in all the files, but I have a collision in an image, it has a .jpg extension, But its GIF (I think) ... And then my foreach stops: (
A How to handle it?
Thank you for your help, I've learned a lot here on Stackevelopeflow, and this is my first question.
You only need to update the following line:
$ filename =" files / nokia_ ". $ Phone_model." .jpg "; < / Code>
to:
I do not think this is the reason that your priority
loop is being stopped though.
Comments
Post a Comment