andy's php projects
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Script and site usage:
All of the scripts on this site are provided free for non-commerical, personal or non-profit use. If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh? If you wish to use any of these in a commercial system, please refer to the payment plan.


Test works,but using it in php:only characters are displayed

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Drop Shadowed Thumbnail Creator
View previous topic :: View next topic  
Author Message
petschu
Newbie


Joined: 18 Aug 2004
Posts: 2

PostPosted: Wed Aug 18, 2004 7:31 am    Post subject: Test works,but using it in php:only characters are displayed Reply with quote

Im using GD2; your test.dropshadow.php works fine. But now I tried to use it with an other PHP/HTML-Script, it failed and only characters are shown Crying or Very sad
This is my code:

<?php require "class.dropshadow.php";?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<html><body>
<?php
echo "<div align=\"center\"><a href=\"javascript:history.back()\"> back </a></div><br>";
?>
<table width="75%" align="center">
<tr>
<td><div align="center">
<?php
$ds = new dropShadow(FALSE);
$ds->setShadowPath('./shadows/');
$ds->loadImage('./images/test.jpg');
$ds->resizeByPercent(50, 0);
$ds->applyShadow('CCCCCC');
header('Content-type: image/png');
$ds->showShadow('png',80);
?>
</div></td></tr></table>
<?php
?></body></html>

Do you have an idea? I tried it without the header-command, but hte same problem!
Back to top
View user's profile Send private message
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Wed Aug 18, 2004 8:50 am    Post subject: Reply with quote

Hi, and welcome to the board!

The showShadow method just outputs raw data to the screen, which is why the header function is used to set the content as a png type. However, what you're doing is setting the header to be html, outputting html and then trying to output raw image data. The test script worked because it ran showShadow before any html was sent to the screen.

If you want to display the image within some html there are two options.

1) Use saveShadow to save the image, rather than showing it, and then use <img> html tag to display.

2) Have the image processing in a separate script, called through an image tag like: <img src="display.php?file=./images/test.jpg">, and then have display.php load the image, add the shadow and then showShadow.

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
petschu
Newbie


Joined: 18 Aug 2004
Posts: 2

PostPosted: Thu Aug 19, 2004 1:18 am    Post subject: Reply with quote

Hi Andy,

thank you for your fast response Very Happy
I tried to use the <img>-tag calling display.php and now it works!
Thanks a lot.

Peter
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Drop Shadowed Thumbnail Creator All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group