Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Endless response from server.
Old 12-09-2008, 06:17 PM Endless response from server.
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
I have a problem which is making me code blind, When I call this script from client via xmlhttp the response should just be a file path string, instead I get an "endless" stream which of course I cannot view because status 4 is never returned. This is necessarily a synchronous call I am including only the code for the called script, as I get the same result no matter where I call it from. I hope someone has an answer, I am totally befuddled at this point! Thx ahead!

PHP Code:
<?php
include $_SERVER['DOCUMENT_ROOT']."ConnectString.php";
$ClientID $_COOKIE["Brag_Flag_user"];
$TxtFldCnt $_GET["TxtFldCnt"];
$TextString $_GET["TextString"];
$Texts split(",",$TextString);
    
//Get Project Info
$SQL="Select * From Projects where ClientID = $ClientID and Status = 'Current'";
$ProjectInfo mysql_query($SQL);
$Info mysql_fetch_array($ProjectInfo);

//Scaling to match Preview "pix" to template "inches" (24 pixels/inch)
$Inch 24;

//Create Text Overlay from blank overlay image
$overlay imagecreatefrompng("Images/Overlay_Blanks/24x36.png");

//Get Stored Text
$SQL="Select * From PreviewText Where ProjectID =".$Info['ProjectID'];
$StoredText mysql_query($SQL);
while(
$Text mysql_fetch_array($StoredText))
    {
        
$SQL="Select * From Texts Where TemplateID = ".$Info['TemplateID']." and TextID = ".$Text['TextID'];
        
$LayoutValues mysql_query($SQL);
        
$Values mysql_fetch_array($LayoutValues);
        
        
//Get Colors
        
$Color $Values['Color'];


        
//Assign Colors
        
$SQL="Select * From Colors Where Name = '$Color'";
        
$ColorRGB mysql_query($SQL);
        
$RGB mysql_fetch_array($ColorRGB);
        
$ShadowColor imagecolorallocate($overlay160160160);
        
$TextColor imagecolorallocate($overlay$RGB['Red'], $RGB['Green'], $RGB['Blue']);

        
//Get Positioning Data for Text
        
$PosLeft $Values['Left']*$Inch
        
$PosHeight  $Values['Height']*$Inch;
        
$PosBottom 864-($Values['Bottom']*$Inch);
        
$PosWidth  $Values['Width']*$Inch;
        
$Font  $Values['Font'];
        
$Shadow $Values['Shadow'];
        
$FontSize round($PosHeight);
        
$box imagettfbbox ($FontSize0$Font$Text['Text']);
        
        
//Size Text
        
while ($box[2] >= $PosWidth)
            {
                
$FontSize $FontSize-1;
                
$box imagettfbbox ($FontSize0$Font$Text['Text']);
            }
        
        
//Center Text
        
$PosCenter round($PosWidth $box[2])/2-($FontSize/4);
        
//Set Destination for TextOverlay Image 
$TextOverlay "Images/Text_Overlays/".$Info['ProjectID'].".png";

        
//Place Text
        
if ($Shadow == 'Yes')
            {
                
//Shadow
                
$offset intval($FontSize/10);
                
imagettftext($overlay,$FontSize0$PosLeft $PosCenter $offset$PosBottom $offset$ShadowColor $Font $Text['Text']);
            }
        
//Text
        
imagettftext($overlay,$FontSize0$PosLeft $PosCenter$PosBottom$TextColor $Font $Text['Text']);
}

//Save TextOverlay
imagesavealpha($overlaytrue);
imagepng($overlay,$TextOverlay);

//Set Destination for Preview Image
$Time time();
$Preview "Images/Previews/".$Info['ProjectID']."_".$Time.".png";
$SQL="Update Projects Set ProjectPreview = '$Preview' Where ClientID = $ClientID and Status = 'Current'";
mysql_query($SQL);

//Create Copy of Blank Project Template for Project Preview
$ProjectPreview imagecreatefrompng("Images/Masks/".$Info['TemplateName'].".png");

//Create Copy of Photo Overlay
$PhotoOverlay imagecreatefrompng("Images/Photo_Overlays/".$Info['ProjectID'].".png");

//Create Copy of Text Overlay
$TextOverlay imagecreatefrompng("Images/Text_Overlays/".$Info['ProjectID'].".png");

//Paste Photo Overlay
imagecopy($PhotoOverlay,$ProjectMask,0,0,0,0,570,864);

//Paste Text Overlay 
imagecopy($PhotoOverlay,$TextOverlay,0,0,0,0,570,864);

//Delete Previous Preview
foreach (glob("Images/Previews/".$Info['ProjectID']."*.*") as $filename)
 {
        
unlink ($filename);
 }
 
//Save Preview
imagesavealpha($$PhotoOverlaytrue);
imagepng($PhotoOverlay,$Preview);
echo 
$Preview;
?>
P.S. To see the problem visit http://www.bragflags.bravehost.com create a flag and then edit text and click on "update".

Last edited by Sleeping Troll; 12-09-2008 at 06:31 PM..
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Endless response from server.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09977 seconds with 12 queries