You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 338 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - imagecreatepng() [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
SideX
Nuke Soldier
Nuke Soldier


Joined: May 17, 2006
Posts: 23


PostPosted: Thu Jun 01, 2006 1:09 pm Reply with quoteBack to top

ok ive created a simple script, and its easier for me to show you then explain it

Code:
<?php

header('Content-type: image/png');
$im = imagecreatefrompng ("blocks_01.png");
$font = 'Hooge_0853.TTF';
$size[1] = 8;
imagettftext($im, $size[1], 0, 15, 15, $color, $font, $title);
imagepng($im);
imagedestroy($im);

?>


View it here http://www.extreme-hq.com/work/themes/eX-Studio/blocks_01.php


What i want to do is use this as an image in my blocks and have it display the title of the block, so i coded my block like so

Code:
<table id="Table_01" width="210" height="201" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>
      <div align="center">
        <div valign="top"><img src="http://www.extreme-hq.com/work/themes/eX-Studio/blocks_01.php"></img></div>
      </div></td>
  </tr>
  <tr>
    <td background="themes/eX-Studio/images/blocks_02.gif" width="210" height="168">
      <table width="95%" border="0" align="center">
        <tr>
          <td>$content</td>
        </tr>
      </table></td>
  </tr>
</table>


and as you can see from here http://www.extreme-hq.com/work/ the image is displayed, but the title isnt, and thats obviousally because my script dosnt know what $title is. Do i have to place my code is a special place? Do i have to have me code connect to the nuke database? or, How do i include this code in my block for it to work?

thanks.
Find all posts by SideXView user's profileSend private message
spottedhog
Captain
Captain


Joined: Apr 30, 2004
Posts: 561


PostPosted: Fri Jun 02, 2006 5:09 am Reply with quoteBack to top

Me thinks all you need to do is place $title in front of the closing img tag.

In the future, you might wish to move all the decorative code into the style.css file.....

_________________
SMF-Nuke admin

SMF and PHP Nuke integration is ready! Take a look at it by clicking on the link above.
Find all posts by spottedhogView user's profileSend private messageSend e-mailVisit poster's website
SideX
Nuke Soldier
Nuke Soldier


Joined: May 17, 2006
Posts: 23


PostPosted: Fri Jun 02, 2006 11:09 am Reply with quoteBack to top

spottedhog wrote:
Me thinks all you need to do is place $title in front of the closing img tag.

In the future, you might wish to move all the decorative code into the style.css file.....


indeed that would work, but that would negate the whole point of using the imagecreatefrompng() function
Find all posts by SideXView user's profileSend private message
TogetherTeam
Site Admin
Site Admin


Joined: May 28, 2004
Posts: 18


PostPosted: Fri Jun 02, 2006 12:53 pm Reply with quoteBack to top

<?php

header('Content-type: image/png');
$im = imagecreatefrompng ("blocks_01.png");
$font = 'Hooge_0853.TTF';
$size[1] = 8;
// Your line
// imagettftext($im, $size[1], 0, 15, 15, $color, $font, $title);

// You can write the title into the image, passing it by GET
imagettftext($im, $size[1], 0, 15, 15, $color, $font, $_GET['title']);
imagepng($im);
imagedestroy($im);

?>

So,

1) You can try to pass "title" by GET.
2) You must call the blocks_01.php from an internal phpnuke file, so you can retrieve the "title" variable by add:

global $title;

before the header method.

Bye Wink
Find all posts by TogetherTeamView user's profileSend private message
SideX
Nuke Soldier
Nuke Soldier


Joined: May 17, 2006
Posts: 23


PostPosted: Fri Jun 02, 2006 6:08 pm Reply with quoteBack to top

perfect!
i changed my block to
Code:
<table id="Table_01" width="165" border="0" cellpadding="0" cellspacing="0">
   <tr>
      
    <td background="http://www.extreme-hq.com/work/themes/eX-Studio/blocks_01.php?title=$title" width="165" height="21">
      <div align="center"><strong></strong></div></td>
   </tr>
   <tr>
      
    <td background="themes/eX-Studio/images/blocks_02.gif" width="165"><table width="95%" border="0" align="center">
        <tr>
          <td>$content </td>
        </tr>
      </table> </td>
   </tr>
   <tr>
      <td>
         <img src="themes/eX-Studio/images/blocks_03.gif" width="165" height="26" alt=""></td>
   </tr>
</table>



and blocks_01.php to
Code:

<?php
header('Content-type: image/png');
$im = imagecreatefrompng ("blocks_01.png");
$font = 'Hooge_0853.TTF';
$size[1] = 8;
$title = $_GET["title"];
imagettftext($im, $size[1], 0, 15, 15, $color, $font, $title);
imagepng($im);
imagedestroy($im);
?>


and it works like a charm
Find all posts by SideXView user's profileSend private message
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
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
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.036 Seconds - 345 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::