Page 1 of 1

[SOLVED] thumbnail script implementation

Posted: Tue Jun 15, 2004 6:39 pm
by sharyn
Platform : Windows XP pro
Server : IIS
PHP ver : PHP ver 4.3.6 with GD

I am trying to implement Thumbnails in PHP by Michael Bailey into my own code and I can't make a thumbnail. I get the "broken image" image and when I right click on it to view image I keep getting this error :

Warning: Cannot modify header information - headers already sent by (output started at c:\inetpub\wwwroot\clickreturn\Thumbs.php: 8 ) in c:\inetpub\wwwroot\clickreturn\Thumbs.php on line 85

The error occurs on the line in Thumbs (Michael's code) that says
header("Content-type: image/jpeg");

It's also followed by garbage that looks like this :
ÿØÿàÿþCREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
plus a bunch of other junk

Michael's code can be found in the link above and my code that calls it looks like this :

Code: Select all

printf("<tr>
         <td><input type="checkbox" name="checkbox".$myrow['MapID'].
           "" value="checkbox"></td>\n
         <td><a href=%s?Map=%s&MapID=%s&Lat=%s&Lon=%s>
            <img src="Thumbs.php?Maps/%s"border="0"></a></td>\n
         <td>%s<center><a href=%s?Map=%s&MapID=%s&Lat=%s&Lon=%s>%s</center></font></td>\n
         <td><center>%s%s</center></font></td>\n
         <td><center>%s%s</center></font></td>\n
        </tr>",
        $_SERVER['PHP_SELF'], $KW, $myrow["MapID"], $Lat, $Lon, $myrow["MapFilename"],
        $fontset, $_SERVER['PHP_SELF'], $KW, $myrow["MapID"], $Lat, $Lon, $myrow["Keywords"],
        $fontset, $myrow["Latitude"],
        $fontset, $myrow["Longitude"]);
Thanks in advance for anyone that can help me make thumbnails on the fly

Posted: Tue Jun 15, 2004 7:02 pm
by infolock

Posted: Tue Jun 15, 2004 7:19 pm
by feyd
note: make sure to read through all of infolocks link.. there were some updates to that code later in the thread.

Posted: Tue Jun 15, 2004 7:19 pm
by sharyn
Infolock,

Thanks for the script. It got rid of the header error, but I still have the junk that appears after what used to be the header error and I still get a "broken image link" image.... I even tried it calling it just like the example, but I get the same thing.

Posted: Tue Jun 15, 2004 7:21 pm
by feyd

Posted: Tue Jun 15, 2004 7:43 pm
by sharyn
ok, I read everything everyone sent me and I still get the header error.. It just wasn't getting it before because it bombed out before it got there...

I have a file called test.php

Code: Select all

<html>
<head>
<title>:: test thumbs ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<!-- <img src="Thumbs.php?NorthAmerica.jpg">-->
<img src="Thumbs2.php?image_to_convert=NorthAmerica.jpg">
</body>
</html>
and I am using InfoLocks code.

I still get the header error and all the junk that gets spewed after the error...

Now what?

Posted: Tue Jun 15, 2004 8:31 pm
by feyd
http://www.devnetwork.net/forums/viewtopic.php?t=1157

for information on what's wrong while getting the header error...

Posted: Wed Jun 16, 2004 12:20 pm
by sharyn
Thanks InfoLock & Feyd for your replies. Feyd, that last article was what did the trick. It works like a champ. I had an extra blank space in front of the "<?php" and it messed it up, but since I took it out, everything works. Thanks again.

- sharyn