Jump to content

How to auto save pictures from a generator?


Zneeky

Recommended Posts

Hello i got a image generator that generates text into an image(Link: http://sroinfo.com/viewpage.php?page_id=43), but the thing i want is it to save it in my image host or in a special folder so people can just copy the url and paste it into a forum.

 

Now i get this url: http://sroinfo.com/signature/_signature_created.php?name=test&name2=test&name3=test&color=1&size=50&color_r=255&color_g=255&color_b=255&HexInput=&size2=15&font=01&shadow=y&font2=01&shadow=y

 

And i want it to be saved as an image directly and show links like this

Viewer: http://sroinfo.com/imghost/?v=signatvfv.gif

BBCode (Forums):[.img]http://sroinfo.com/imghost/images/test.gif[./img]

URL: http://sroinfo.com/imghost/images/signatvfv.gif

 

Or just be saved direcly under remote here: http://sroinfo.com/imghost/

 

This is the code i need to change

<?php

$name = stripslashes($_GET['name']);
$name2 = stripslashes($_GET['name2']);
$name3 = stripslashes($_GET['name3']);
$size = stripslashes($_GET['size']);
$size2 = stripslashes($_GET['size2']);
$font = 'images/avatar_maker/fonts/'.stripslashes($_GET['font']).'.ttf';
$font2 = 'images/avatar_maker/fonts/'.stripslashes($_GET['font']).'.ttf';
$fontcolor['r'] = stripslashes($_GET['color_r']); // font color - RED
$fontcolor['g'] = stripslashes($_GET['color_g']); // font color - GREEN
$fontcolor['b'] = stripslashes($_GET['color_b']); // font color - BLUE
$shadow = stripslashes($_GET['shadow']);
$lines = stripslashes($_GET['lines']);
function arrow($im, $x1, $y1, $x2, $y2, $alength, $awidth, $color){
///
}
switch ($_GET['color']) {
case '1':
$bgpic = 'images/avatar_maker/1.gif';
break;
case '2':
$bgpic = 'images/avatar_maker/2.gif';
break;
case '3':
$bgpic = 'images/avatar_maker/3.gif';
break;
case '4':
$bgpic = 'images/avatar_maker/4.gif';
break;
case '5':
$bgpic = 'images/avatar_maker/5.gif';
break;
case '6':
$bgpic = 'images/avatar_maker/6.gif';
break;
case '7':
$bgpic = 'images/avatar_maker/7.gif';
break;
case '8':
$bgpic = 'images/avatar_maker/8.gif';
break;
case 'random':
$num = mt_rand(1,;
if($num == 1){ $bgpic = 'images/avatar_maker/1.gif'; }
elseif($num == 2){ $bgpic = 'images/avatar_maker/2.gif'; }
elseif($num == 3){ $bgpic = 'images/avatar_maker/3.gif'; }
elseif($num == 4){ $bgpic = 'images/avatar_maker/4.gif'; }
elseif($num == 5){ $bgpic = 'images/avatar_maker/5.gif'; }
elseif($num == 6){ $bgpic = 'images/avatar_maker/6.gif'; }
elseif($num == 7){ $bgpic = 'images/avatar_maker/7.gif'; }
elseif($num == { $bgpic = 'images/avatar_maker/8.gif';}
break;
default:
$num = mt_rand(1,;
if($num == 1){ $bgpic = 'images/avatar_maker/1.gif'; }
elseif($num == 2){ $bgpic = 'images/avatar_maker/2.gif'; }
elseif($num == 3){ $bgpic = 'images/avatar_maker/3.gif'; }
elseif($num == 4){ $bgpic = 'images/avatar_maker/4.gif'; }
elseif($num == 5){ $bgpic = 'images/avatar_maker/5.gif'; }
elseif($num == 6){ $bgpic = 'images/avatar_maker/6.gif'; }
elseif($num == 7){ $bgpic = 'images/avatar_maker/7.gif'; }
elseif($num == { $bgpic = 'images/avatar_maker/8.gif';}
}


$im = imagecreatefromgif($bgpic);
//Calculate, the centre:
for(;{
list($image_width, $image_height) = getimagesize($bgpic);

$text_width = $right_x - $left_x;
if($image_width > $text_width+5){
break;
}
$size = $size - .5;
if($size == 1){
die('Script not responding to decreasing font size, in other words: try using less letters.');
}
$size2 = $size2 - .5;
if($size2 == 1){
die('Script not responding to decreasing font size, in other words: try using less letters.');
}
}
$padding = ($image_width - $text_width)/2;

$textcolor = imagecolorresolve($im, $fontcolor['r'], $fontcolor['g'], $fontcolor['b']);

$grey = imagecolorallocate($im, 128, 128, 128);

if($shadow == 'y'){
imagettftext($im, $size, 0, $padding-228, 62, $black, $font, $name);
imagettftext($im, $size2, 0, $padding-228, 102, $black, $font, $name2);
imagettftext($im, $size2, 0, $padding-228, 83, $black, $font, $name3);
}
if($lines == 'y'){

//imagettftext($im, $size, 0, $padding+1, 77, $grey, $font, $name);

}

imagettftext($im, $size, 0, $padding-230, 60, $textcolor, $font, $name);
imagettftext($im, $size2, 0, $padding-230, 100, $textcolor, $font, $name2);
imagettftext($im, $size2, 0, $padding-230, 81, $textcolor, $font, $name3);
if($_GET['dl']){
header('Content-Disposition: attachment; filename="avatar.gif"');
}
header("Content-type: image/gif");
imagegif($im);



?>

 

yeah i notice that, but still when im trying to save it it i get this file insted _signature_created.php. And its not being saved in any folder on my site. I had another script that did that but i could not make it work with this new one.

 

$counterval = 0;
$filename = "banners/counter.txt";
$fp = fopen($filename, "r");
$counterval = fread($fp, 26);
fclose($fp);
$counterval = (integer)$counterval + 1;
$fp = fopen($filename, "w+");
fwrite($fp, $counterval, 26);
fclose($fp);
$newbanner = 'banners/' . $counterval . '.png';
ImagePNG($image, $newbanner);

echo "\n";
echo "<a href=\"$newbanner\" target=\"_blank\"><img src=\"$newbanner\" width=\"500\" height=\"110\" border=\"0\"></a>\n";
echo "\n\n";
include("footer.inc");
} 
if ($counterval > 5) {
$deletebanner = (integer)$counterval - 5;
$delete = 'banners/' . $deletebanner . '.png';
unlink("$delete");
} 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.