Sigx

We are the future in the past.
It is currently Tue Mar 19, 2024 2:19 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: not reciving data from servers
PostPosted: Tue Sep 14, 2004 9:48 pm 
Offline

Joined: Mon Feb 16, 2004 9:44 pm
Posts: 16
arlight.. when i upload the remote sigx programs to my server it doesnt getnerate.. all it gives me is " Powered by: sigx.yuriy.net "

even when i tried to view the data by adding in the print $data or what ever the var was it doesnt show me anything.. is there a way to correct this

the url to the sigx file is

http://artofassassin.com/sigx/sig.php

thx


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 14, 2004 10:35 pm 
Offline

Joined: Mon Mar 15, 2004 1:48 pm
Posts: 1397
Location: Los Angeles
which remote sigx.php file are you trying?

_________________
Image

Image

Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 16, 2004 2:54 pm 
Offline

Joined: Mon Feb 16, 2004 9:44 pm
Posts: 16
this would be the text only one.. ive also uploaded the img one

http://www.artofassassin.com/sigx/sigx.php


also is there a way to make it generate a picture and save it onto my server under /home/~marinecr/public_html/sigx/images/<username>.jpg?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 16, 2004 4:11 pm 
Offline

Joined: Mon Mar 15, 2004 1:48 pm
Posts: 1397
Location: Los Angeles
sure, give it the picture name when doing imagepng("name.png")

http://us4.php.net/manual/en/function.imagepng.php


it saves the jpg or png whatever you tell it to to the folder you specify, in the case above its same folder as the php script, every time the script is ran.

_________________
Image

Image

Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 16, 2004 8:38 pm 
Offline

Joined: Thu Jul 03, 2003 3:06 pm
Posts: 652
maybe you'll also be interested in redirecting the link.

http://forum.yuriy.net/phpbb/viewtopic. ... t=redirect

_________________
Image
~~~SigX C++ Edition~~~


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 16, 2004 9:04 pm 
Offline

Joined: Mon Feb 16, 2004 9:44 pm
Posts: 16
well.. im not exacly looking for a redirection like that..
im realy trying to genereate the image.. been failing at it to LOL

Hey Yuriy ive tried adding teh lines it said.. but it doesnt make the image still

ive just reverted back to the default now.. think you can help me?

ALSO i know there is away to set var from the addy bar.. like sigx.php?username=jamman

so taht $username=jamman but.. how does this work exacly? i couldnt get it to work


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 16, 2004 9:30 pm 
Offline

Joined: Mon Mar 15, 2004 1:48 pm
Posts: 1397
Location: Los Angeles
to get it from the url its


so if its like: sigx.php?var=yourname
$_GET['var'] would = "yourname"



to save the file, just replace the imagepng(); with imagepng('sig.png') that should save the generated image.

_________________
Image

Image

Image


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 17, 2004 2:35 pm 
Offline

Joined: Mon Feb 16, 2004 9:44 pm
Posts: 16
ok the var thing worked so now the link is..

http://www.artofassassin.com/sigx.php?un=A+Cow

you can change A+Cow with anything you want..


but ive shearcehd the document for hte imagepng and there is noting the only thing you have is the imagemerge and then the return thinggy.. am i missing something?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 17, 2004 3:38 pm 
Offline

Joined: Mon Mar 15, 2004 1:48 pm
Posts: 1397
Location: Los Angeles
ok on line 186

Code:
imagePNG($im);


if you make it

Code:
imagePNG($im,"myimage.png");



it will save it into that folder.

_________________
Image

Image

Image


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 20, 2004 2:26 pm 
Offline

Joined: Mon Feb 16, 2004 9:44 pm
Posts: 16
ooo ok.. i was shearcing for ImagePNG()

ok.. i did as you said.. but now when ever i try and use it i get this error

The image ôhttp://www.artofassassin.com/sigx/sigx.php?un=A+Cowö cannot be displayed, because it contains errors.

ive swiched it back now.. its odd i think


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 20, 2004 2:50 pm 
Offline

Joined: Mon Mar 15, 2004 1:48 pm
Posts: 1397
Location: Los Angeles
i'd have to see the php script to tell ya what the problem is

_________________
Image

Image

Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 21, 2004 11:10 pm 
Offline

Joined: Mon Feb 16, 2004 9:44 pm
Posts: 16
riteo

Code:
<?
// SigX Remote Image Generater (Basic Background)
// Version 1.1,
// Notes: you can use any image, JPG PNG or GIF (gif untested), any size and dimention. just make sure its big enough to fit your biggest text
// this code does not resize the background image.
// my email: [email protected]


// Settings, Edit
// This is the only part you need to edit.
// Username Setting

//$un = "";
$_GET['un'];
// background image location
$backIMG = "sigxmonster2.png"; // you can use URL for the image here too, JPG

// where the text goes on the image, offset to blank area on the image, in pixels.
$Xoffset=90;
$Yoffset=50;


////////////////////////////////////////////////////
// No need to go further.
///////////////////////////////////////////////////
// Code, Only edit if you know what you are doing!!
//////////////////////////////////////////////////

$alldata = getSomeData($un); // We get signal. It is you. How are you gentleman? Make your time now.

if (empty($alldata)) { die("cant contact server to get any data"); }

$fc = GetMid($alldata,"<fc="," \fc>"); // font color
$bc = GetMid($alldata,"<bc="," \bc>"); // background color (not used if background image set)
$fz = GetMid($alldata,"<fz="," \fz>"); // font size
$trans = GetMid($alldata,"<trans="," \\trans>"); // the \\t so we can type letter t. if background image is not set (transparencys not work if using imagecreatetruecolor() which i am.)
$data = GetMid($alldata,"<data="," \data>"); // the data from sigx.yuriy.net server, what we got to work with.

//<fc=0,0,0 \fc>
//<bc=255,255,255 \bc>
//<fz=2 \fz>
//<trans=1 \trans>
//<data=Visit http://sigx.yuriy.net \data>

if( $data ){ // if we get the data ok
   drawIt($data, $fc, $bc, $fz, $trans, $Xoffset, $Yoffset, $backIMG);
   //echo "$data, $fc, $bc, $fz, $trans, $backIMG";
}


//
////
// cool functions
////

function drawIt($data, $fontcolor="0,0,0", $backcolor="255,255,255", $font="2", $transperancy=1, $Xoffset=2, $Yoffset=2, $backIMG=''){
   
   // max amount of lines
   $maxElements = 10;
   
   if( $data ) {
      // if we pass our data dynamic array string
      $data = explode("*<*",$data);
   }

   
   if ( file_exists($backIMG) ){
      
      # reading image
      $image = @getImageSize($backIMG, $info); # $info, only to handle problems with earlier php versions...
      switch($image[2]) {
      case 1:
         # GIF image
         $bkIMG = @imageCreateFromGIF($backIMG);
         break;
      case 2:
         # JPEG image
         $bkIMG = @imageCreateFromJPEG($backIMG);
         break;
      case 3:
         # PNG image
         $bkIMG = @imageCreateFromPNG($backIMG);
         break;
      default:
         # PNG
         $bkIMG = @imageCreateFromPNG($backIMG);
         break;
      }
      
      //$bkIMG = @imageCreateFromPNG($backIMG); // create the background image from a PNG file
      $bkIMG_width=imageSX($bkIMG);  // get width and height of the background image
      $bkIMG_height=imageSY($bkIMG);       
      // we set the width and height based on the background image provided.
      $width = $bkIMG_width;
      $height = $bkIMG_height;
   }
      
   if ( !$bkIMG ) { // if no background image is set
      if( is_array($data) ){ // if we have the data
         
         $data = array_slice($data, 0, $maxElements); // cut off the limitation of lines
         
         for($x = 0; $x <= count($data); $x++){ // find the widest line, and we have our width
            $curWidth =  ImageFontWidth($font) * strlen($data[$x]) + $Xoffset+2;
            if($curWidth > $defaultWidth){
               $defaultWidth = $curWidth;
            }
         }
         if($defaultWidth > 500) { $defaultWidth = 500; }   
         $width  = $defaultWidth;
         
         // lets do the same for height
         $curHeight = ImageFontHeight($font) * count($data) + $Yoffset + 2;      
         
         if ($curHeight > $defaultHeight){ $defaultHeight = $curHeight; }
         $height = $defaultHeight;      
            
      } else { // if its just an offline msg or single element
         
         $curWidth =  ImageFontWidth($font) * strlen($data) + $Xoffset+2;
                  
         if($curWidth > $defaultWidth){
            $defaultWidth = $curWidth;
         }
   
         if($defaultWidth > 500) { $defaultWidth = 500; }
         $width  = $defaultWidth;
         
         $curHeight = ImageFontHeight($font) + $Yoffset+2;         
         if ($curHeight > $defaultHeight){
            $defaultHeight = $curHeight;
         }
               
         $height = $defaultHeight;
      }
   }
   
   
   $im = @imagecreatetruecolor ($width,$height); // create the image
   
   $fColor = explode(",",$fontcolor); // font color
   $bColor = explode(",",$backcolor); // back color
   
   $bgc = imagecolorallocate ($im, $bColor[0], $bColor[1], $bColor[2]); // default white
   imagefilledrectangle($im, 0, 0, $width, $height, $bgc);

   //mergePix(&$sourcefile, $insertfile, $pos=1,$transition=100)
   if ($bkIMG){ // if we found a background image
      @mergePix($im, $bkIMG, 1); // put our background image on top left
   }

   // if transperent (....)
   // note: if using imagecreatetruecolor transperancy is not working. but if your using a img it makes no difference
   //if ( $transperancy == 1) { // only used if no backgrouns image set, only works for PNG, maybe GIF
      //ImageColorTransparent($im, $bgc);
   //}
   
   
   // lets allocate some colors
   $fontColor = imagecolorallocate ($im, $fColor[0], $fColor[1], $fColor[2]);
   $black = imagecolorallocate ($im, 0, 0, 0);
   
   if( is_array($data) ){
   // start outputing the info, line by line
      for($x = 0; $x< count($data); $x++){
      imagestring ($im, $font, $Xoffset, ImageFontHeight($font) * $x + $Yoffset,  $data[$x], $fontColor);         
      }
   } else {
      imagestring ($im, $font, $Xoffset, $Yoffset,  $data, $fontColor);
   }


   # output
   switch($image[2]) {
      case 1:
      # GIF image
      header("Content-type: image/gif");
      imageGIF($im, $un + ".gif");
      break;
   case 2:
      # JPEG image
      header("Content-type: image/jpeg");
      imageJPEG($im, $un + ".jpeg");
      break;
   case 3:
      # PNG image
      header("Content-type: image/png");
      imagePNG($im, $un);
            break;
   default:
      # PNG image
      header("Content-type: image/png");
      imagePNG($im, $un);
      break;
   }
   
   # cleaning cache
   imageDestroy($im);   
   imageDestroy($bkIMG);
}



// Functions, belong to their respective owners.
function ImageStringWrap($image, $font, $x, $y, $text, $color, $maxwidth)
{
   $fontwidth = ImageFontWidth($font);
  $fontheight = ImageFontHeight($font);

   if ($maxwidth != NULL) {
       $maxcharsperline = floor($maxwidth / $fontwidth);
      $text = wordwrap($text, $maxcharsperline, "\n", 1);
    }

   $lines = explode("\n", $text);
   while (list($numl, $line) = each($lines)) {
       ImageString($image, $font, $x, $y, $line, $color);
       $y += $fontheight;
    }
}

// Align string on image
// $x and $y values
// 0 align left or top
// 1 align center
// 2 align right or bottom
function ImageStringAlign(&$image, $font, $x, $y, $s, $col) {
 switch ($x) {
   case 0: $x = 2; break;
   case 1: $x = floor((ImageSX($image) / 2) - ((ImageFontWidth($font) * strlen($s)) / 2)); break;
   case 2: $x = (ImageSX($image) - (ImageFontWidth($font) * strlen($s))) - 2; break;
 }
 switch ($y) {
   case 0: $y = 2; break;
   case 1: $y = floor((ImageSY($image) / 2) - (ImageFontHeight($font) / 2)); break;
   case 2: $y = (ImageSY($image) - ImageFontHeight($font)); break;
 }
 ImageString($image, $font, $x, $y, $s, $col);
}

function getSomeData($username=""){
   // this allows us to get the remote data
   
   $alldata = '';
   $username = urlencode($username); // encode in case name has spaces
   
   $fd=fopen("http://sigx.yuriy.net/remote/textout.php?username=$username","r");
   while ($line=fgets($fd,1000))
   {
       $alldata.=$line;
   }
   fclose ($fd);
   return $alldata;
}

function GetMid($TheStr, $sLeft, $sRight){
   $pleft = strpos($TheStr, $sLeft, 0);   
   if ($pleft !== false){
      $pright = strpos($TheStr, $sRight, $pleft + strlen($sLeft));         
      If ($pright !== false) {
         return (substr($TheStr, $pleft + strlen($sLeft), ($pright - ($pleft + strlen($sLeft)))));
      }
   }
   return '';
}

//$sourcefile = Filename of the picture into that $insertfile will be inserted.
//$insertfile = Filename of the picture that is to be inserted into $sourcefile.
//$targetfile = Filename of the modified picture.
//$transition = Intensity of the transition (in percent)
//$pos          = Position where $insertfile will be inserted in $sourcefile
//                0 = middle
//                1 = top left
//                2 = top right
//                3 = bottom right
//                4 = bottom left
//                5 = top middle
//                6 = middle right
//                7 = bottom middle
//                8 = middle left
//
//
function mergePix(&$sourcefile, &$insertfile, $pos=1,$transition=100)
{
   
//Get the resource id?s of the pictures
    //$insertfile_id = imageCreateFromPNG($insertfile);
    //$sourcefile_id = imageCreateFromPNG($sourcefile);
   $insertfile_id = $insertfile;
   $sourcefile_id = $sourcefile;

//Get the sizes of both pix   
    $sourcefile_width=imageSX($sourcefile_id);
    $sourcefile_height=imageSY($sourcefile_id);
    $insertfile_width=imageSX($insertfile_id);
    $insertfile_height=imageSY($insertfile_id);

//middle
    if( $pos == 0 )
    {
        $dest_x = ( $sourcefile_width / 2 ) - ( $insertfile_width / 2 );
        $dest_y = ( $sourcefile_height / 2 ) - ( $insertfile_height / 2 );
    }

//top left
    if( $pos == 1 )
    {
        $dest_x = 0;
        $dest_y = 0;
    }

//top right
    if( $pos == 2 )
    {
        $dest_x = $sourcefile_width - $insertfile_width;
        $dest_y = 0;
    }

//bottom right
    if( $pos == 3 )
    {
        $dest_x = $sourcefile_width - $insertfile_width;
        $dest_y = $sourcefile_height - $insertfile_height;
    }

//bottom left   
    if( $pos == 4 )
    {
        $dest_x = 0;
        $dest_y = $sourcefile_height - $insertfile_height;
    }

//top middle
    if( $pos == 5 )
    {
        $dest_x = ( ( $sourcefile_width - $insertfile_width ) / 2 );
        $dest_y = 0;
    }

//middle right
    if( $pos == 6 )
    {
        $dest_x = $sourcefile_width - $insertfile_width;
        $dest_y = ( $sourcefile_height / 2 ) - ( $insertfile_height / 2 );
    }
       
//bottom middle   
    if( $pos == 7 )
    {
        $dest_x = ( ( $sourcefile_width - $insertfile_width ) / 2 );
        $dest_y = $sourcefile_height - $insertfile_height;
    }

//middle left
    if( $pos == 8 )
    {
        $dest_x = 0;
        $dest_y = ( $sourcefile_height / 2 ) - ( $insertfile_height / 2 );
    }
   
//The main thing : merge the two pix   
    imageCopyMerge($sourcefile_id, $insertfile_id,$dest_x,$dest_y,0,0,$insertfile_width,$insertfile_height,$transition);
return $sourcefile_id;
}

?>


im not shure if its something im doing.. or if it just dont like it.. but well.. im shure you can tell me ( a few other php gurus cant understand it either)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 21, 2004 11:34 pm 
Offline

Joined: Thu Jul 03, 2003 3:06 pm
Posts: 652
I dont know your reasons for doing this because when you request the image from this script when using imagePNG($im); it would just return the image to the browser and generate a new image each time that page is loaded on someones computer, you dont need to have it save to HD for that.

I dont know why you would want to save it to HD but if you did want to save it, it would probobly have to be some sort of cron job, and you would not need to return the other stuff like header("Content-type: image/jpeg"); which just tells the browser what type of data its recieving.

If you want to have it save the image to HD each time the image is requested and send the image to the user, Again i dont know why you would want that as well, you could call imagePNG($im); and imagePNG($im, $un...); in the same script one after another.

what this code does is actually writes the header and the image out to the browser that requested the page.
Code:
     
header("Content-type: image/gif");
imageGIF($im);

If you rewrite it to just save to HD what it would return to the borwser is a header of image type and a boolean variable for whether the image was saved to HD or not, and the boolean variable is a 0 or a 1 not an image.

_________________
Image
~~~SigX C++ Edition~~~


Last edited by buddy1007 on Wed Sep 22, 2004 12:18 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 21, 2004 11:56 pm 
Offline

Joined: Mon Mar 15, 2004 1:48 pm
Posts: 1397
Location: Los Angeles
what exactly do you want the script to do?


the problem with your script is your calling the $un on the lines 188 and 178 and the others, but you should be calling it $_GET['un'] because, first of all you didnt set $un to be anything, and your server globals are probably off.

also make sure you set the right permission on the folder which your saving the generated image to.


so line 13 should look like this:

Code:
$un = $_GET['un'];



and then these lines, should look like this:

Code:
   switch($image[2]) {
      case 1:
      # GIF image
      header("Content-type: image/gif");
      imageGIF($im);
      imageGIF($im, $_GET['un'] + ".gif");
      break;
   case 2:
      # JPEG image
      header("Content-type: image/jpeg");
      imageJPEG($im);
      imageJPEG($im, $_GET['un'] + ".jpeg");
      break;
   case 3:
      # PNG image
      header("Content-type: image/png");
      imagePNG($im);
      imagePNG($im, $_GET['un'] . "png");
            break;
   default:
      # PNG image
      header("Content-type: image/png");
      imagePNG($im);
      imagePNG($im, $_GET['un'] . "png");
      break;
   }



i added a imagePNG($im) (and jpeg and gif) so it also displays the image on the page as well as saves it to the HD.

_________________
Image

Image

Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 23, 2004 7:08 pm 
Offline

Joined: Mon Feb 16, 2004 9:44 pm
Posts: 16
hrmm.. ok il try that.. i had something similar before but i wasnt usnting the get_["un"] i was just using the $un and it seemed to work for the frist part.. well.. we shall see


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group