[SOLVED] thumbnail script implementation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
sharyn
Forum Commoner
Posts: 33
Joined: Tue Jun 15, 2004 6:39 pm
Location: So Cal

[SOLVED] thumbnail script implementation

Post 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
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

note: make sure to read through all of infolocks link.. there were some updates to that code later in the thread.
User avatar
sharyn
Forum Commoner
Posts: 33
Joined: Tue Jun 15, 2004 6:39 pm
Location: So Cal

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

User avatar
sharyn
Forum Commoner
Posts: 33
Joined: Tue Jun 15, 2004 6:39 pm
Location: So Cal

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

http://www.devnetwork.net/forums/viewtopic.php?t=1157

for information on what's wrong while getting the header error...
User avatar
sharyn
Forum Commoner
Posts: 33
Joined: Tue Jun 15, 2004 6:39 pm
Location: So Cal

Post 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
Post Reply