Jump to content

problems calling other scripts


adam291086

Recommended Posts

Hello, i am having problems calling on another script to generate a thumbnail image. I got the code from http://www.waiheke.co.nz/php/thumb/index.htm I have a file called

 

thumbnail.php

<?php
// useage is thumbnail.php?im=imagename.jpg
// set for 120 px thumb
Header("Content-type: image/jpeg"); 
$orig_image = imagecreatefromjpeg($im);
list($width, $height, $type, $attr) = getimagesize($im); 
if ($width > 120) { 
$ratio = 120 / $width; 
$newheight = $ratio * $height; } 
else $newheight = $height; 
$sm_image = imagecreatetruecolor(120,$newheight) or die ("Cannot Initialize new gd image stream");; 
Imagecopyresampled($sm_image,$orig_image,0,0,0,0,120,$newheight,imagesx($orig_image),imagesy($orig_image)); 
imageJPEG($sm_image); 
imagedestroy($sm_image); 
imageDestroy($orig_image); 
?>

 

then i have another page called template.php

<?php



error_reporting(E_ALL);
$folder = glob("images/Pic/*.jpg");

foreach($folder AS $file)
{
//large image
$large = $file;
//thumbnail

$t="thumbnail.php?im=";
// then using image 36022.jpg as an example

$f=$file;
$file25 = $t . $f;
$v='<img src=$file25';
?>

<img src="<?php echo $file25; ?>" alt="Generating thumb">

<br>

<?php
}


?>


 

all i get is a little square box saying the image can't be found. I have tried everything so far. You can see whats happening http://adamplowman.co.uk/galley/template.php here

 

Link to comment
Share on other sites

You might want to browse directly to thumbnail.php?im=path_to_image and see if there are any errors generated.

 

You probably ought to encode the image path before it's passed in the URL and decode it in thumbnail.php too, though i don't think that is likely to be causing the error.

Link to comment
Share on other sites

Comment out the header(); statement in thumbnail.php, add the following two lines to thumbnail.php after the opening <?php tag -

 

ini_set ("display_errors", "1");
error_reporting(E_ALL);

 

, and browse directly to thumbnail.php, with a valid ?im=path_to_image parameter on the end of the url.

Link to comment
Share on other sites

i have up loaded a smaller picture and now i get this http://adamplowman.co.uk/galley/thumbnail.php?im=images/Pic/DSCF0033.JPG

ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛC $.' ",#(7),01444'9=82<.342ÿÛC 2!!22222222222222222222222222222222222222222222222222ÿÀZx"ÿÄ ÿĵ}!1AQa"q2‘¡#B±ÁRÑð$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ ÿĵw!1AQaq"2B‘¡±Á #3RðbrÑ $4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz‚ƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚâãäåæçèéêòóôõö÷øùúÿÚ?ñEY$ z㹩Šò}ið."oxFmJì;/î”ç5šIj ·¡kÃÞÂòå:rŠGzëÚÖ!Bì$·@+NÞÒx• gzV>¯4W·¿Ùª|»X—;—<*u õ?ʆ4`Ia¤Éº¦¢¢ÚÒF U ‘ýìçŸÂ±î£Ð$¸+¨Â03¹âc“éÀ j²ëÍ!ÊÛ¡ÛC¢/n=k<%+š*wÔè Ðî®"G²ž;ý9àô¥:>°ŒÙÓ¥ÔDÀþV$0\ÆÂXRe#£¨#õ®ŽÇÅž!Ó–7™Þx3Òâ<ƒÿëúÒæ@èK±Uí®`lÜY]EXÎ?¾õ¡â-e´Ëx ´O6úå¼»xýýO°£Ì»t-\ÌÊÆ}²^:æ8ÉéþÓz(ÿ<ןx¼¾‘·GŠáäyGŸ{!\\œŽ} ¯Iдì»Bes5ìÇ}ÄÍÕ›Óè; òjUñÌÃËòãcèÁIçñ©“ÐÒš¼¬dÁg¾ÕîÂF¤(ã–>ƒüúU–»–±Ù¼°F;†Ú\÷'äT· Emin:ˆüÆí1Ïþ‚˜Â=±K$|üʹ'éÓžk»ž/*ЈÝݳ7SõÞi©ys"Ìå˜|ÛŽCB}jý´‰;ù6jË& Ë3`w<úUe¹¶›+qj£?òÒ´}¹Ú~œ}hWê veû-MMœðÃt¶/0"DÉücŒŒŽÇì{VÖ“âíf%Kh®íod_•b•Nâ=ŸŒŸ rSéí#@ëpÊùxqÔ†^)âfIðTàŠ«Ûc'·i£Ò#øŽ¶ìbÔ´©¢˜‡òàÖžâm/ÄW>T*ð^*’PG|ãÚ¼ŽYW2HìÎÇ%˜ä“W|=¨ÿd붷ž_˜#~Tu Œ~ujW9êRJü§¡jŸèñ\Ãw£Ë#»'‹NҲn-ü;ss1\›R2Ò M¤cç#¿¯jô+˜ê8®Q7Iß{ñ‚?#Y‚ÒÛS–êi!Žx~X—z‚qëîØü+C˜áÛÂÞ{ÊmoHÕ€~en3ÁwWQ+g¡³Ûı««:(ûÇ+üÅ´ê} ´UŠ0Š1Å`Y“xŸQÖ¯[m=1è§nXþ¿ ^ÕõEÒ´÷¸a¾V;!Œuw=rž)º—K𵦕,™½ºc=ÉÔ’søàÀhl¨«‹ xÚþ{Kˆàš-Ȧ$\¼® þÐáx9õ®Ò=Ê«“·–sßh?Ž¨ÂœT°Höó$±‘½O~GÐûv¬[}NÚpQc¥¼i®ZB$ð;Ø~U~ód¶Ñλ¥· Ë"y ûõç¿áNæÙZ/´ÛÀHÜ;ÄßÝ>Þ‡¿Ö–Òy-äÊAt#*ÃЊNËSTÝí.¤Öšå‚”·‘Œ, ¼D¬?ýj”Ánm>ÕlÒá^7<ÆqÇ=Çç6#‚Æç”—ìmÝdRÈ~„d¡ëK7‘km%¼2‰%ÆùpB€:“õ8ôÅC‘º†š²Š© øÔ¾OŸ2£iKnw6}ò©m£y¤¤n[\ö«ºØÆLL²Nxiâ?÷}Oû_— $M¯¹‘qiåÏqr <—a‘Õ”µÃ@Ö5˜ 9 ïUQ×úVNHùÁ ôüøþµë~п³´Ô½>åA+ŽUzσ[A]œu¦’:ÆFŽF¡ŠŒ('ük ýÍŒðÅò—£Ç3¿ú?tl+”ñeÊXÝi—çÈóˆ“p0GäFkc‰ß‘YÚ(ÈiTcÙïý”QLv[­f6B"·.ï¼à~Š:(µÀÊÒÓûZþÕ›þ<íIK4'ï7wÿ?ҹψ6Ó7ˆad†B qNOJô;{X|¸¢Ž-–ªTÕ8Ìu¨u}ø}DLÈÙ2@í3ÈCü&´*2³¹æ:.s []=²n–ßnP ƒîO^Z£ue5š¸¶™’ªì¸V óƒÞºx´½æ…Èt½LŒWñ.P–º|`üÍ#7à? zF—ÉÎ1ŒñùW’|D¿[¯¥²·ÉiÙ›“úm åÏÝ,°ÝÀìLŠ@žŠþtV?‚¤dÖBgïE–ú䉢„)åáûT‘é¨qæÓq¶.ãêÝ?:Ö±º‰î¥µ‰>XUAa÷A?Ãõμ†ÚæüLekéaÇ#'Ó5vßÄz†—ŽC!vù÷’{ÈçúÌùQÓõY¨s3Ù•ÀÅq?<:/4¦Ô¢c¾Õ2SåsÉÏZè´r×^Ó’îØ‘Î×¾ò7¡«:͔ږueÞT“ÆP9ÆÎ+v®Žx·|âÄæ Ú\ˆHe3Éî+©á¦¶uHígDXÜ× ÙUÏ>Ô‘ü>Õ$r!hü‚Jùħúr3Ð÷ëY8¶vF¤V·(.¥¢’˃òŽF?Zºocò‚— IÝz{ŠÀÕ´Ét»÷·ºUÐ…9ñªknxÎê‹XÖ÷Øën˜úŽkñºŒ’sþ•[°ŠòþDµ¶‚IÊ™ì2p2{s[kðûÄÒ8Tõw™H•5öœc£d|?³«½ÄåÕ-v²íle³Àý {P@ªÒ±|=á»oèÿc‰·Hÿ4²ã’ÞßNÕu® ™{ÉQ ©fcÑG¹ö —»£8fùÝѹªA¢éSßNFØ×å\òÍÙGÔ×€Þ]=ä³ÜÎùšf,çÜžk¥ñ~¾úíÜqÀXYÄäĬOÌ{¹ý1è½rÐÙMqx¶öù’g=‡AEî 6:¿Z™ï&¼ÇÈ1œuî¥Øh:Ridp¯P9>§¹¢ª+C9=O3–mŽ{w¬íJüL@s´òAãð£P'aäö¬¿áük‚…ߘõ1Ÿ*‰½¢x’ïJÔ¢žÒQÀWGû®;î¯gÒüB5½.ì(æu $Àuüõ¯¶PÉózõÕÒ|>šSâ+XŽaff1î;IÚyÇL×fÇW=sXí¡]A÷£"H»‚ 1ÉãŒ÷5GÃ:Õ½ì·: ýÌ™Œ+Dávë• ôAúUùdu’ÐaºàƒƒÔmn+HU%}IæiXÉ×ü7£ë¯_nI9HÞ7Á$öéŒñX𽆨º‹\™ ÕYV)a*Ièr·¾+·§S²¸)´¬S½±Ë†[Vm«0oPs´ûUËYf6ê×VCÔ Q”ﻕFvž[üK;²‘ „$}ªWÆáU׬tˆ—S`ãˆÔeÛè+É|OâÛíqäCˆm|+g-œÇ¹öè?Zê<0Æáoeœ™d2(.ÿ1

 

 

Link to comment
Share on other sites

What version of PHP? There was a stupid bug in php 5.2.4 that gives a 500 error page instead of error output even when you have display_errors and error_reporting turned on.

 

For your last post with a smaller file, if you uncomment the header(); statement, it will probably work. This indicates there is probably a fatal php error related to memory. Checking your web server log file would help find what error is occurring.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.