Old 02-12-2007, 08:37 PM   #1 (permalink)
Illgamez Insomniac
 
ncyphe's Avatar
 
Join Date: May 2006
Location: Texas
Posts: 2,210
Reputation: 43
Default PHP image creation

Essentially, what I'm trying to get into php.

More specifically, I'm trying to learn how to make dynamic sigs using YouTubes Developer API's (xml returns).

Now, I'm running php (with apache) on my computer with default settings, and am having a terribly hard time locating any tutorial on how to proper set up my GD functionality.

It was in my perception that GD was already apart of PHP 5, but every time I try an example piece of code, it only returns the URL as an error.

I'd really appreciate some help in terms of a discussion as to what I need to do before I can run basic PHP GD functions.
__________________
Now, an official Game Dev student.
Visit my FPSBanana profile and Studio to see what I've been working on recently.

Quote:
[[Inuyasha: Episode Infinity]]
Naraku: --Evil laughter-- Oops! Killed your girlfriend again, Inuyasha!
Inuyasha: Bullshit, you know how many cliffs Kikyo's fallen off? She'll be fine. Hell, I pushed her off one last week.
EnB emulator, resurecting the dead
ncyphe is offline  
Old 02-13-2007, 01:10 AM   #2 (permalink)
Dante’s Inferno
 
naruto1327's Avatar
 
Join Date: May 2006
Location: OLD PROFILE. NEW: NOODLEPOWA
Posts: 608
Reputation: 10
Send a message via AIM to naruto1327 Send a message via MSN to naruto1327 Send a message via Yahoo to naruto1327
Default

Ah, yes, a response to this would certainly answer many of my answers too.

Please help.
naruto1327 is offline  
Old 02-13-2007, 03:00 AM   #3 (permalink)
Sun? What Sun?
 
Dennis56's Avatar
 
Join Date: Aug 2006
Location: дома
Posts: 951
Reputation: 10
Default

http://us2.php.net/manual/en/ref.image.php
Dennis56 is offline  
Old 02-13-2007, 04:51 AM   #4 (permalink)
Illgamez Insomniac
 
ncyphe's Avatar
 
Join Date: May 2006
Location: Texas
Posts: 2,210
Reputation: 43
Default

I've read over that several times now, but everytime I try out the options, I get the same error.

Ultimatly, what I'm asking is (from anyone who has their own server or virtual server who uses GD [graphics dev]) to let me know how they got the GD to function, if it didn't already come to default on.

Id really love to figure this out. I've done it online, and would like to be able to do it on my testing server.


What I plan to do is use the YouTube API's to allow people to create a dynamic sig that lists the latest 3 uploads and titles, or latest favorites. (Ironically, no one has done this yet, exept for one guy who made a strange banner that does me no good.)
__________________
Now, an official Game Dev student.
Visit my FPSBanana profile and Studio to see what I've been working on recently.

Quote:
[[Inuyasha: Episode Infinity]]
Naraku: --Evil laughter-- Oops! Killed your girlfriend again, Inuyasha!
Inuyasha: Bullshit, you know how many cliffs Kikyo's fallen off? She'll be fine. Hell, I pushed her off one last week.
EnB emulator, resurecting the dead
ncyphe is offline  
Old 02-13-2007, 05:01 AM   #5 (permalink)
Sun? What Sun?
 
Dennis56's Avatar
 
Join Date: Aug 2006
Location: дома
Posts: 951
Reputation: 10
Default

If your using web hosting maybe its your web host

try doing it with localhost

if your creating image did you download gd at http://www.libgd.org/Main_Page?

Last edited by Dennis56; 02-13-2007 at 05:24 AM.
Dennis56 is offline  
Old 02-13-2007, 03:05 PM   #6 (permalink)
Illgamez Insomniac
 
ncyphe's Avatar
 
Join Date: May 2006
Location: Texas
Posts: 2,210
Reputation: 43
Default

Well, php says that it comes standard after 2.x.x, and I have version 5.

Also, I'm not using a web host, as I said, it's on my computer.

There was something I read about editing the configuration file; however, I'm having a hard time location the correct file to modify the "--with-gd".


Note: I'm slowly giving up on this.
__________________
Now, an official Game Dev student.
Visit my FPSBanana profile and Studio to see what I've been working on recently.

Quote:
[[Inuyasha: Episode Infinity]]
Naraku: --Evil laughter-- Oops! Killed your girlfriend again, Inuyasha!
Inuyasha: Bullshit, you know how many cliffs Kikyo's fallen off? She'll be fine. Hell, I pushed her off one last week.
EnB emulator, resurecting the dead
ncyphe is offline  
Old 02-13-2007, 09:52 PM   #7 (permalink)
Sun? What Sun?
 
Dennis56's Avatar
 
Join Date: Aug 2006
Location: дома
Posts: 951
Reputation: 10
Default

well unless your doing php on the desktop there is really no need for it i only used it once before
Dennis56 is offline  
Old 02-15-2007, 12:57 AM   #8 (permalink)
Illgamez Insomniac
 
ncyphe's Avatar
 
Join Date: May 2006
Location: Texas
Posts: 2,210
Reputation: 43
Default

I've given up on my testing server. I decided to start testing with my web host.

Anyway, I'm now in another bind. I developed an xml parser to properly par the xml's generated by the YouTube api's, but now I'm haveing problems with merging images.

What I'm trying to do is merger the preview image into the sig banner. Everytime I get a success, the previews don't appear.

I'm requesting a link to a tutorial that explains how to properly copy one image into another in PHP. tutorialized.com, isn't prooving to be of any help.
__________________
Now, an official Game Dev student.
Visit my FPSBanana profile and Studio to see what I've been working on recently.

Quote:
[[Inuyasha: Episode Infinity]]
Naraku: --Evil laughter-- Oops! Killed your girlfriend again, Inuyasha!
Inuyasha: Bullshit, you know how many cliffs Kikyo's fallen off? She'll be fine. Hell, I pushed her off one last week.
EnB emulator, resurecting the dead
ncyphe is offline  
Old 02-21-2007, 05:29 AM   #9 (permalink)
Illgamez Insomniac
 
ncyphe's Avatar
 
Join Date: May 2006
Location: Texas
Posts: 2,210
Reputation: 43
Default

OK, as an update to what I'm doing, the youtube siggy in my signature is a work in process.

To explaine simply what I have done, I'm uysing the YouTube api's (offered freely to anyone) to request a profile hit on recent videos. The hit returns an XML file which is parsed.

After which, the php goes in and creates the image, copy's over the thumbnails (from a link provided in the xml) and titles, clips the titles if they are too long.

Now, as you can see, I'm having problems.
1) I'm trying to get it to work with the get[] functions, but for some reason it doesn't work; howver, it works fine if I declare the same thing in a var. (very odd)
2)I can't seem to figure out how to get above font 5.

here's the code for those who like: (yes you can take it, modify it, and use it. I don't plan on creating a service around it, but will upload the final code with instructions for fellow youtubers here.)
PHP Code:
<?php
//$ID = $_get['id'];
$ID "ncyphe";
//vars
$Smax 15;                      //max chars for titles
$SposX = array(0,150,300);    //X-location for thumbnails and titles

//functions
header("Content-type: image/png");

$videoA;
$c = -1;
$iFlag;
$gDFlag false;
$td '0';

function 
openElement($parser$element$attributes
{
    global 
$gDFlag;
    global 
$td;
    global 
$c;
    
$td $element;
    switch(
$element)
    {
        case 
'video_list':
        case 
'ut_response':
            
$iFlag false;
            break;
        case 
'video':
            
$iFlag false;
            
$gDFlag false;
            
$c++;
            break;
        default:
            
$iFlag true;
            
$gDFlag true;
            break;
    }
}

function 
closeElement($parser$element
{
    if(
$element == 'video')
    {
        
    }
}

function 
characterData($parser$data
{
    global 
$videoA;
    global 
$gDFlag;
    global 
$c;
    global 
$td;
    if(
$gDFlag)
    {
        
$videoA[$c][$td] = $data;
    }
}

function 
run()
{
    
}
$parser xml_parser_create();

xml_parser_set_option($parserXML_OPTION_CASE_FOLDINGfalse);
xml_set_element_handler($parser"openElement""closeElement");
xml_set_character_data_handler($parser"characterData");

$document file_get_contents("http://www.youtube.com/api2_rest?method=youtube.videos.list_by_user&dev_id=YNg4pTUlFh8&user=" $ID);
xml_parse($parser$document);

xml_parser_free($parser);



   
$im imagecreatetruecolor(450,175);
   
imagefill($im00imagecolorallocate($im254254255));
   
$im2 imagecreatetruecolor(450,50);
   
imagefill($im2,0,0,imagecolorallocate($im2225,225,225));
   
imagecopymerge($im,$im2,0,0,0,0,450,50,100);
   
   
imagestring($im,5,5,5,"YouTube Latest videos for ",imagecolorallocate($im000));
   
imagestring($im,5,250,5$IDimagecolorallocate($im0,0,200));
   
   for(
$i=0;$i<3;$i++)
   {
        
$vidCov imagecreatefromjpeg($videoA[$i]['thumbnail_url']);
   
        
$back imagecolorallocate($im000);
        
//$px = (imagesx($im) - 7.5 * strlen($string));

        
$width imagesx($vidCov);
        
$height imagesy($vidCov);
   
        
imagecopymerge($im,$vidCov,$SposX[$i]+10,70,0,0,$width,$height,100); 
        
        
$string $videoA[$i]['title'];
        if(
strlen($string)>$Smax)
        {
            
$string substr($string,0,$Smax);
            
$string $string "..";
        }
        
        
imagestring($im,3,$SposX[$i] + 10,55,$string,imagecolorallocate($im000));
    }
   
   
imagepng($im);
   
imagedestroy($im);


?>
edit: I may have just figure out that I can't use the get[] method for image editing. I request assistance from anyone who might have an alternative.
__________________
Now, an official Game Dev student.
Visit my FPSBanana profile and Studio to see what I've been working on recently.

Quote:
[[Inuyasha: Episode Infinity]]
Naraku: --Evil laughter-- Oops! Killed your girlfriend again, Inuyasha!
Inuyasha: Bullshit, you know how many cliffs Kikyo's fallen off? She'll be fine. Hell, I pushed her off one last week.
EnB emulator, resurecting the dead

Last edited by ncyphe; 02-21-2007 at 05:32 AM.
ncyphe is offline  
 

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:53 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.0
OnRPG, Copyright ©2003-2011, Game Entertainment Enterprises