Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all! We have been experiencing an issue on site where threads have been missing the latest postings. The platform host Vanilla are working on this issue. A workaround that has been used by some is to navigate back from 1 to 10+ pages to re-sync the thread and this will then show the latest posts. Thanks, Mike.
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

imagettftext multiple images at same time, no saving but direct output?

  • 01-10-2012 2:31am
    #1
    Registered Users, Registered Users 2 Posts: 3,515 ✭✭✭


    Hey, I am doing small quick project in college, so the story is as follows:
    I have database with like reminders table.
    I want it to select all records for specific user (no problem with that) and output all records into sticky notes.
    It works just fine but I just can't get seperate note/sticky for each entry, script stops at first row and I end up having just 1 image.
    Codes are as follows:
    <?php
    header('Content-Type: image/png');
    function GenerateNote($title, $deadline, $text, $priority, $name, $date){
        $image = "../images/stick".rand(1, 8).".png";
        $titlefont = "../ThrowMyHandsUpintheAirBold.ttf";
        $textfont = "../ThrowMyHandsUpintheAir.ttf";
        $t = substr($title, 0, 10);
        $dline = "Deadline: ".$deadline;
        $tex = wordwrap(substr($text, 0, 90), 20, "\n", true);
        $pr = $priority;
        $curdate = "Added: ".$date;
        $name = imagecreatefrompng($image);
        imagealphablending($name, true);
        imagesavealpha($name, true);
        $color = imagecolorallocate($name, 0, 0, 0);
        imagettftext($name, 30, 0, 80, 210, $color, $titlefont, $t);
        imagettftext($name, 20, 0, 80, 165, $color, $titlefont, $dline);
        imagettftext($name, 15, 3, 80, 250, $color, $textfont, $tex);
        imagettftext($name, 20, 3,90, 400, $color, $textfont, $curdate);
        imagettftext($name, 25, 3,95, 430, $color, $titlefont, $pr);
        imagepng($name);
    }
    include 'sql_connection.php';
    $getList = mysql_query("SELECT * FROM reminders WHERE user=0");
    while($data = mysql_fetch_assoc($getList)){
        GenerateNote($data['title'], $data['deadline'], $data['text'], $data['priority'], $data['id'], $data['date']);    
    }
    ?>
    
    
    

    DB queries are done successfully, I tested by echo'ing them. It gives out just 1 image like this:
    Untitled-1_zps8ecdd0d3.jpg

    Oh and by the way, if I try and put
    include 'sql_connection.php';
    $getList = mysql_query("SELECT * FROM reminders WHERE user=0");
    while($data = mysql_fetch_assoc($getList)){
        GenerateNote($data['title'], $data['deadline'], $data['text'], $data['priority'], $data['id'], $data['date']);    
    }
    

    in other file, and include this code file, it doesn't work for some reason. But anyways how do I make it output all images?

    $name is so that every name is different, it takes reminder entry id as name.
    Help?
    I just want all sticky notes to print across page (I will make script later so it randomly spreads them around, but for now I need to sort out this thing.)


Comments

  • Registered Users, Registered Users 2 Posts: 3,515 ✭✭✭arleitiss


    crap, sorry just realized wrong section, please move to Development


Advertisement