Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > MISCELLANEOUS > Archives > Bug Report 1.4.x

Post Reply
 
Thread Tools
  #1  
Old 11-18-2005, 11:16 AM
eon's Avatar
eon Offline
pixelpost guru
 
Join Date: Nov 2005
Location: Ned
Posts: 280
Send a message via ICQ to eon
Smile Addon "Add text"

I'am working on a addon for a schoolproject. I choose to make an addon for Pixelpost because I use it for my self (http://www.northing.nl), the flexibility of the program and the beautifull code.

My addon gives the user the chance to add text in stand of photo's in Pixelpost, like a blog. When you write text my addon makes a picture of the text and after that you can generate a thumbnail. It is a function that I miss in Pixelpost.

To create the thumbnail I wrote a function called "textoimage".
PHP Code:
function texttoimage ($title$text$dir$file$bg_color$title_color$text_color$font_height_text$font_height_title$image_h$image_w $maxtextwidth$x_pos_text$y_pos_text$x_pos_title$y_pos_title$fonttype_title$fonttype_text$fontangle_title$fontangle_text){
    
//create new image
    
$img_handle imagecreate ($image_w$image_h) or die ("Cannot Create image");

    
//set colors
    
list($bg_r,$bg_g,$bg_b)= split(",",$bg_color);
    list(
$title_r,$title_g,$title_b)= split(",",$title_color);
    list(
$text_r,$text_g,$text_b)= split(",",$text_color);
    
$background_color imagecolorallocate ($img_handle$bg_r$bg_g$bg_b);
    
$title_color imagecolorallocate ($img_handle$title_r$title_g$title_b);
    
$text_color imagecolorallocate ($img_handle$text_r$text_g$text_b);
    
    
//place text
    
$fontwidth imagefontwidth($font_height_text);
    
$fontheight imagefontheight($font_height_text);
    
    
//split-up the text in rows
    
if ($maxtextwidth != NULL) {
        
$maxcharsperline floor($maxtextwidth $fontwidth);
        
$text wordwrap($text$maxcharsperline"\n"1);
    }
    
    
//insert text in image
    
$lines explode("\n"$text);
    
imagettftext ($img_handle$font_height_text$fontangle_text$x_pos_text$y_pos_text$text_color$fonttype_text$text);
    
    
//insert title in image
    
imagettftext ($img_handle$font_height_title$fontangle_title$x_pos_title$y_pos_title$title_color$fonttype_title$title);
    
    
//save the image (Leave the string, woman and childeren first!!)
    
imagejpeg ($img_handle,$dir.$file,100);
    
    
//remove the image out the memory
    
imagedestroy($img_handle);

Screenshot 1, this is a screenshot of the image that is generated and you can select the croparea.
http://tweakers.net/ext/f/39f86e4069...1beaf/full.jpg

Screenshot 2, this is a screenshot of how it is looklike when your text is a thumbnail.
http://tweakers.net/ext/f/890b291139...0b4af/full.jpg

So far I can make a thumbnail and fill the database with the correct data. But there are still thing I have to do.

TODO:
- Show the text on the right way on the frontsite
- Edit and delete the text.
- Write a correct installation.

The only problem is that I hack the Pixelpost so far that you can't speak anymore of an addon. For exmple I use the "New Image"-code to make my "New Text"-code. When I put the code in my addon, then it is not working. It has to stand in the index.php of the admin.
I can use some advise about this subject.

If there is any questions please ask. My story could be a little bit confusing because yesterday I had a party and now I have a little hangover.

Because my bad condition I just see that I put the thread in "Bugs" instand of "Addons". Moderator, can you correct this or do I have to make a new thread?
__________________
Northing.nl

Last edited by eon; 11-18-2005 at 11:47 AM. Reason: wrong thread
Reply With Quote
  #2  
Old 11-18-2005, 12:02 PM
raminia's Avatar
raminia+ Offline
Team Pixelpost
 
Join Date: Jan 2005
Location: FL, US
Posts: 3,706
Send a message via Yahoo to raminia
no bug here.
__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7
Reply With Quote
  #3  
Old 11-18-2005, 01:49 PM
eon's Avatar
eon Offline
pixelpost guru
 
Join Date: Nov 2005
Location: Ned
Posts: 280
Send a message via ICQ to eon
Quote:
Originally Posted by raminia
no bug here.
Idd, this thread has to be moved to Addons.
__________________
Northing.nl
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 11:33 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs