**before going on: I used header and specified the type but was told that this information was passed. When I checked the type it did return image/jpeg which is why this truly stumps me. What is returned by fopen and fread seems to be symbolic still.
Expand|Select|Wrap|Line Numbers
- <html>
- <body>
- <?php
- $percent=0.5;
- $filename="http://bytes.com/images/dtown.jpg";
- $fp=fopen($filename,"rb");
- $file=fread($fp,filesize($filename));
- list($width,$height)=getimagesize($file);
- $new_width=$width*$percent;
- $new_height=$height*$percent;
- $image_p=imagecreatetruecolor($new_width,$new_height);
- $image=imagecreatefromjpeg($file);
- imagecopyresampled($image_p,$image,0,0,0,0,$new_width,$new_height,$width,$height);
- imagejpeg($image_p,null,100);
- fclose($fp);
- ?>
- </body>
- </html>
Expand|Select|Wrap|Line Numbers
- Warning: getimagesize(ÿØÿà) [function.getimagesize]: failed to open stream: No such file or directory in C:\Inetpub\vhosts\dumountaineer.com\httpdocs\dbimages\test.php on line 8
- Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in C:\Inetpub\vhosts\dumountaineer.com\httpdocs\dbimages\test.php on line 11
- Warning: imagecreatefromjpeg(ÿØÿà) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in C:\Inetpub\vhosts\dumountaineer.com\httpdocs\dbimages\test.php on line 12
- Warning: imagecopyresampled(): supplied argument is not a valid Image resource in C:\Inetpub\vhosts\dumountaineer.com\httpdocs\dbimages\test.php on line 13
- Warning: imagejpeg(): supplied argument is not a valid Image resource in C:\Inetpub\vhosts\dumountaineer.com\httpdocs\dbimages\test.php on line 14
Is there a way to make this work? I am using a Windows Parallels Plesk Server and the symbols don't look like binary.
***I tried without opening the file and just linking to it and the entire image was just symbols. The PHP manual recommends using fopen but the symbols keep appearing. I have used fread and readfile to try and open the image. All help is appreciated.