Thumbnail script (GD)
Jeg har dette script, og mit JPG ligger som det skal :$filename = "images/lotto.jpg";
$thumbFilename = "tn2_lotto.jpg";
$thumbMaxWidth = 80;
$thumbMaxHeight = 80;
$img = imageCreateFromJPEG($filename);
$imgWidth = imageSX($img);
$imgHeight = imageSY($img);
// Skaler thumbnail først efter bredde, derefter (hvis nødvendig) efter højde
if ($imgWidth > $thumbMaxWidth) {
$forhold = $imgWidth / $thumbMaxWidth;
$imgWidth = $thumbMaxWidth;
$imgHeight = (int)($imgHeight / $forhold);
}
if ($imgHeight > $thumbMaxHeight) {
$forhold = $imgHeight / $thumbMaxHeight;
$imgWidth = (int)($imgWidth / $forhold);
$imgHeight = $thumbMaxHeight;
}
$imgThumb = imageCreate($imgWidth, $imgHeight);
imageCopyResized($imgThumb, $img, 0, 0, 0, 0, $imgWidth, $imgHeight, imageSX($img), imageSY($img));
imageJPEG($imgThumb, $thumbFile) or die("Kunne ikke lave TN");
imageDestroy($imgThumb);
imageDestroy($img);
Men jeg får dette output :
ÿØÿà�JFIF������ÿþ�>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛ�C� $.' ",#(7),01444'9=82<.342ÿÛ�C 2!!22222222222222222222222222222222222222222222222222ÿÀ��P�P"�ÿÄ����������� ÿÄ�µ���}�!1AQa"q2‘¡#B±ÁRÑð$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ�������� ÿÄ�µ��w�!1AQaq"2B‘¡±Á #3RðbrÑ $4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz‚ƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚâãäåæçèéêòóôõö÷øùúÿÚ���?�÷ú(¨//-ì,å»»™a·…KÉ#œ¤Û²'¬ kÆÞðôÿ�gÔµH£¸ï ‘×€~` íÈ#ÆkÇücñSR×] 4v›OÓ°U°@–ns’ÃîŽ:)îrH8|¹*b’Ò'Ð`òÔ\Õ¼–ç»ÿ�Âíðßüøêß÷ê?þ9N‹ã_†d™#{]R%f�Èð¡U¹Ã“ì ö¯ÙL+X¬TBy ºýçÕz/Št?ø•jp\¸Œ@í�@$£a€ÉãÖ½|x’Io2M±°ttbXr#¡¯YðÅ©’x´ŸN Pß·ÞSØJ{ƒÇÍÔ¹É#ªu-ϕʽuøžÕEVç’࿲¾ðΡª¡ á&0êYL‡„pX¨ü{WÊi\¸™Ùr£ÝÈðÊuYtÛÔ‘V¤H´úò¤Ï¾£a1Le©) J,ºMØT*ËT]tÙàbàhø5ãInÕ¼3¨Î]âMö/#ìbääàr<è õúøÿ�JÕ.tM^×S³m·Ò ’ÇU8 í# Žà‘_^Ã4WG<$°È¡ÒD`ÊÊFAuW£JWGÇc©(Tæ]O?øÏ{-¯1íÙww2dü~(µåÿ� ü\}'þÛè—¯Xø¿cßÃ˹ŸvûIbš<â,çÛkµxg„õÿ�øF|Ii«ý›í?gßû¯3fíÈË×{=;V´¨›=,»ÞÁÎÝÝ|ìvZ6“k¬üf¾¶¼òšÔ.eh¤?ëv» cžpHô¶,þ$jwÞ6M*æʤÜOöa,UŸh/œÀ ýÓ‚0:×7®|D·Ô^ #@·Ñõ8®…ɾդs†X„ƒ»'$ƒÜÖœ_la•¯¢ð~œš»!&ñXÞrøÙ»“‘»$g½cxÇi[[úž£§VªN¥.ow•+¯u÷ùéª×C{@¹›Ã_%ðŽ›&ÍIšc€Ì ·€Çœ�ÃœóTá`øˆ|GþÈû\b:·Ù|¿%3åùÛqœg8ï\>âë ?Æ1ø’ù^þä3´¤Ø\²ëƒ€3Àª‡_ÿ�ŠÇþ³ÿ�ÌCí¾Fÿ�úi¿nì~ÇáRª»Y;køÏ7*‘R|‰_¼µ»ï}µ=[SºŸÄÃ:”Öï£Ù:Ý¥¬Ššâ@é–åÉ*xÚÒ±lþ'j·þ<Hº±‡ûæãû<éó@•YöùÉÞ—îžFQÄë>0º¿ñ«øžÉÆç|nˆ$ß·jÁ8F:+¦_‹vPÌuü¦®²Pæô8¼*All݃“‘»$qžõ¼gvõêy°ÎŠä¿º—MWóîŽGÇÚ5§‡ük©i–ÖÖ&C»n*ñžàÀÏ8ÆIë_Hx?þDþÁÖÿ�ú-kåMKQ»Õµïïçyî§mÒHÝIþƒ°€}aá‹i¬¼)£ÚÜÆcžc‘U`€ùŠÞžìóñ·Tâ¤õ.j61jzeÝ„å„7P¼.PႲqïƒ_%jºmÖ‰«]i—©¶âÚCð@8èà Á‚ }}^_ñcÀë°®·£Û#j)1"÷(�Á¬¸<]ÐöjŒšBia†[™ã†ÞY¤`‰)ff'��:’khÄâG# ð7‡[Å.²ÓÚ2öÁ¼Ûž¸)ËdŽFx\ú°¯«kŒømà±àý�ý ÄÎókÝ|Ù ŒíAŽ>\žGRO$b»:é„lYTž› ¢Š*ÎSÎükð›Mñ$’ß鎺~¨ìÒHØ&9ØâùI ÃÕ‰Mx¦¿à¯xjI´tÙ…¼|ýª%/ ¶ƒ¼p2{G×ÕôT8&uÒÆNš³ÕdÐNkìýIÕdI5.ÊñÐmV¸·I @XSì4;JGM;Oµ³W9u·…c}öšŸdth+|'̾øuâo:m=íí™C‹«°bŒ©©Œ°8þzŒà×»x'áæ—àÛrêVóQrw^IReA“´c¯9'©Æ�ì(«PHå Š]6AEUÇÿÙ