Reply
Can you check my short code snippet please?
Old 03-27-2007, 04:53 PM Can you check my short code snippet please?
Skilled Talker

Posts: 54
Hi

I want users to be able to create an image from either an image template on my site (labelled $im) or by entering in a url.I think i've worked it out, but my php is not very good so can you tell me where i'm going wrong with it please?

I realised that the

PHP Code:
$im imagecreatefromjpeg($im
doesn't have to point to a variable, it can also point to a url i.e

PHP Code:
$im imagecreatefromjpeg(http://www.address.com/image.jpeg) 
YEY- This works, however when i try adding a tick box to the html form that the user checks when they want to specify an address i get the url coming up instead of the image.

This is the code that i have put in the php file...

PHP Code:
if($link== 'y'){
$im imagecreatefromjpeg($useraddress);
}else{
$im imagecreatefromjpeg($im);

The checkbox is called link and the textbox for the address is called useraddress.

If you want to see for yourself what its doing go to www.gamesigs.co.uk/test.php

Cheers and i hope to hear from you soon.
digi duck is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 03-27-2007, 05:11 PM Re: Can you check my short code snippet please?
solomongaby's Avatar
Webmaster Talker

Latest Blog Post:
How Do You Find Music Online ?
Posts: 522
Name: Gabe Solomon
Location: Romania
1. that page doesn't work ( the link you gaved )
2. you must have register_globals on ... to use $link instead of $_POST['link']
or are you converting globals to local variables you're self ?
3. try puting
PHP Code:
$im =  @imagecreatefromjpeg($useraddress); /* Attempt to open  */
   
if (!$im) echo "Can't open image [ $useraddress ]"

solomongaby is offline
Reply With Quote
View Public Profile Visit solomongaby's homepage!
 
Old 03-27-2007, 06:28 PM Re: Can you check my short code snippet please?
Skilled Talker

Posts: 54
sorry that didnt work any other ideas. p.s try the link again.
digi duck is offline
Reply With Quote
View Public Profile
 
Old 03-27-2007, 07:21 PM Re: Can you check my short code snippet please?
solomongaby's Avatar
Webmaster Talker

Latest Blog Post:
How Do You Find Music Online ?
Posts: 522
Name: Gabe Solomon
Location: Romania
can you post more code here ... to make a more acurete ideea
solomongaby is offline
Reply With Quote
View Public Profile Visit solomongaby's homepage!
 
Old 04-20-2007, 02:33 PM Re: Can you check my short code snippet please?
Skilled Talker

Posts: 54
Ye sure...

I now am having even worse problems i cant get the image to be created from the url.

Here is my code and to summarise all i want to do is for a person to submit a url on a form that it sends to this page (my register globals are off) and puts the text they specify onto the image from the url. Thanks a lot.

PHP Code:
<?php

header
("Content-type: image/jpeg");

$name stripslashes($_GET['name']);

$line2 stripslashes($_GET['line2']);

$size stripslashes($_GET['size']);

$centre stripslashes($_GET['centre']);

$font 'images/sig_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

$lines stripslashes($_GET['lines']);

function 
arrow($im$x1$y1$x2$y2$alength$awidth$color){
///
}

if(
is_numeric($_GET['color']) && $_GET['color'] >= '1' && $_GET['color'] <= '63')
{
    
$bgpic 'images/sig_maker/' $_GET['color'] . '.jpeg';
}


$im imagecreatefromjpeg($bgpic);


//Calculate, the centre:

for(;;){

list(
$image_width$image_height) = getimagesize($bgpic);
list(
$left_x, , $right_x) = imagettfbbox($size0$font$name);
$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.');
}
}
$hpadding = ($image_width $text_width)/2;
$vpadding = ($image_height/2);

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

imagettftext($im$size0$hpadding,$vpadding$textcolor$font$name);
imagettftext($im$size -10,0,$hpadding,$vpadding+$size,$textcolor,$font,$line2);

}else{

imagettftext($im$size$angle$x$y$textcolor$font$name);
imagettftext($im,$size 10,$angle,$x,$y+$size,$textcolor,$font,$line2);

}

imagegif($im);
imagedestroy($im);
?>
digi duck is offline
Reply With Quote
View Public Profile
 
Old 04-21-2007, 04:44 PM Re: Can you check my short code snippet please?
Skilled Talker

Posts: 54
ok i've just realised my host suddenly and without warning decided to disable fopen so i think this is why it isnt working, Only local files can be opened. Is there any way to get around this?
digi duck is offline
Reply With Quote
View Public Profile
 
Old 04-21-2007, 11:25 PM Re: Can you check my short code snippet please?
mgraphic's Avatar
Truth Seeker

Posts: 2,305
Name: Keith Marshall
Location: West Hartford, CT
They probably disabled cURL
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 04-25-2007, 12:21 PM Re: Can you check my short code snippet please?
Junior Talker

Posts: 4
Location: in your browser
do you have php.ini in your root folder.

try this:
create php.ini in your root folder
add this line.
allow_url_fopen = on
__________________
Submit URL
[Free Web Directory] - no reciprocal - no email needed for inclusion.
brealmz is offline
Reply With Quote
View Public Profile Visit brealmz's homepage!
 
Reply     « Reply to Can you check my short code snippet please?
 

Thread Tools

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

vB 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.14491 seconds with 13 queries