הרשם שאלות ותשובות רשימת חברים לוח שנה הודעות מהיום

חזור   הוסטס - פורום אחסון האתרים הגדול בישראל > עיצוב גראפי, תכנות על כל שפותיו וקידום ושיווק אתרים > פורום תיכנות

   
|!|

 
 
כלים לאשכול תצורת הצגה
Prev הודעה קודמת   הודעה הבאה Next
ישן 09-04-09, 23:50   # 2
Slash
חבר מתקדם
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
גיל: 35
הודעות: 522

Slash לא מחובר  

קוד:
imagechar($img, $font_size, $xpos, $ypos, $str, $color);
מצאתי במנואל פונקציה שמישהו רשם , אולי תקח מפה כמה חלקים שמתאימים לך .
קוד:
A quick function to automatically generate a multi line image from a string, with the image size automatically calculated from the string itself. 

<?php 

function multilineimage($string){ 

    // Probably not the best way of handling newlines, but bar OS9, doesn't really cause a problem 
    $string = str_replace("\r","",$string); 
    $string = explode("\n",$string); 

    $maxlen = 0; 
    foreach ($string as $str){ 
        if (strlen($str) > $maxlen){ 
            $maxlen = strlen($str); 
        } 
    } 

    // Set font size 
    $font_size = 4; 

    // Create image width dependant on width of the string 
    $width  = imagefontwidth($font_size)*$maxlen; 
    // Set height to that of the font 
    $height = imagefontheight($font_size) * count($string); 
    // Create the image pallette 
    $img = imagecreate($width,$height); 
    // Grey background 
    $bg    = imagecolorallocate($img, 205, 255, 255); 
    // White font color 
    $color = imagecolorallocate($img, 0, 0, 0); 

    $ypos = 0; 

    foreach ($string as $str){ 

        $len = strlen($str); 
        for($i=0;$i<$len;$i++){ 
            // Position of the character horizontally 
            $xpos = $i * imagefontwidth($font_size); 
            // Draw character 
            imagechar($img, $font_size, $xpos, $ypos, $str, $color); 
            // Remove character from string 
            $str = substr($str, 1);   
        } 
        $ypos = $ypos + imagefontheight($font_size);   
    } 

    // Return the image 
    header("Content-Type: image/gif"); 
    imagegif($img); 
    // Remove image 
    imagedestroy($img); 
} 

multilineimage("This is an image 
This is line 2\nLine 3 
Line 4"); 

?>
__________________
Aziza Web Magazine

Always account for variable change
  Reply With Quote
 

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 


חוקי פירסום
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 מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 03:41.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ