Toms Posted January 4, 2006 Report Share Posted January 4, 2006 Bilde, kas nākusi no NOKIA 6020 un vēl dažiem citiem telefoniem - met erroru, kad gribu to resaizot. Rezultātā parādās resaizota bilde, bet viss pilnīgi melns + šis errors: Warning: imagecreatefromjpeg(): 'att.jpg' is not a valid JPEG file in D:\celjsh\index.php on line 39 Atradu info: I have noticed that Nokia's old camera-phones create non-standard JPEG's. Nokias' JPEG doesn't end with 0xFFD9. Add 0xFFD9 end of file and image works fine with imagecreatefromjpeg(). Atvēru to bildi ar WinHex editoru - nekā, ir beigās tai bildei 0xFFD9. tātad šis nevarētu būt pie vainas. Kādi citi varianti, kā apiet erroru? Link to comment Share on other sites More sharing options...
Delfins Posted January 4, 2006 Report Share Posted January 4, 2006 Nu un kur problēma? nemākam izmantot fopen() fwrite()? Link to comment Share on other sites More sharing options...
Toms Posted January 4, 2006 Author Report Share Posted January 4, 2006 Kas, tu neredzi??? "Atvēru to bildi ar WinHex editoru - nekā, ir beigās tai bildei 0xFFD9"! Link to comment Share on other sites More sharing options...
Delfins Posted January 4, 2006 Report Share Posted January 4, 2006 sorry, iedod bildi, lūdzu.. Link to comment Share on other sites More sharing options...
Toms Posted January 4, 2006 Author Report Share Posted January 4, 2006 Reku, veselas divas bildes: Att Att2 Link to comment Share on other sites More sharing options...
Kristabs Posted January 4, 2006 Report Share Posted January 4, 2006 jap, man arii - Warning: imagecreatefromjpeg(): 'temp_bildes/897.jpg' is not a valid JPEG file in **.php on line 309 Link to comment Share on other sites More sharing options...
php_Stopp Posted January 4, 2006 Report Share Posted January 4, 2006 hm.. tie nav wbmp.. ? man ar tāda problēma bija, ja kas.. neatrisināju tā arī ;) Link to comment Share on other sites More sharing options...
Delfins Posted January 4, 2006 Report Share Posted January 4, 2006 (edited) nav gan... re kur risinājums... // Atdod atpakaļ GD_ImageResource function imageCreateFromJpegEx($file) { $data = file_get_contents($file); $im = @imagecreatefromstring($data); while (!$im) { $data = substr_replace($data, "", -3, -2); $im = @imagecreatefromstring($data); } return $im; } PS: Ja `pārtulkojām` cilvēku valodā... nahrinizē visu biegās izņemot tos 0xFFD9, līdz izdodas atvērt JPEG Edited January 4, 2006 by Delfins Link to comment Share on other sites More sharing options...
v3rb0 Posted January 4, 2006 Report Share Posted January 4, 2006 imagemagicks saprot ar mogrify resaizoja un pamainīja kvalitāti/sharpingu abām bildēm. pēc tam resaizotā bilde ir 'pareiza' un imagecreatefromjpeg() nelamājas. vari mēģināt 'nepareizās' bildes šādi pārseivot par 'pareizām'. Link to comment Share on other sites More sharing options...
Delfins Posted January 4, 2006 Report Share Posted January 4, 2006 Un ja nav tā imagick-a ?!.. Risinājumu prasīja iekš GD Link to comment Share on other sites More sharing options...
v3rb0 Posted January 4, 2006 Report Share Posted January 4, 2006 kur tur teikts ka ar GD. prasīja tak: "Kādi citi varianti, kā apiet erroru?" nesaku ka mans variants labāks vai sliktāks, tak gandrīz jebko var izdarīt/atrisināt pa N dažādiem ceļiem :) Link to comment Share on other sites More sharing options...
Delfins Posted January 4, 2006 Report Share Posted January 4, 2006 labi, kurš dabūs alu, - lai lemj pats Toms ;) Link to comment Share on other sites More sharing options...
php_Stopp Posted January 4, 2006 Report Share Posted January 4, 2006 heh, varētu foruma noteikumus pamainīt - nevis 'Pasakiet paldies tiem, kas palīdzējuši', bet 'Iedodiet aliņu tiem, kas palīdzējuši' ;) Link to comment Share on other sites More sharing options...
Toms Posted January 4, 2006 Author Report Share Posted January 4, 2006 Delfins, Tevis dotā funkcija function imageCreateFromJpegEx($file) nepalīdz. Vēlams būtu ar GD tikt galā.. Un vēl - kā lai vispār nosaka vai tās bildes ir "traumētās"? Link to comment Share on other sites More sharing options...
Delfins Posted January 4, 2006 Report Share Posted January 4, 2006 Kā nepalīdz!? Man gan palīdz, 100% saku ;) Link to comment Share on other sites More sharing options...
Recommended Posts