Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 434551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:17:09+00:00 2026-05-12T20:17:09+00:00

$image=’xiaofl.jpg’; $img=getimagesize($image); switch ($img[2]) { case 1: $im =imagecreatefromgif($image); break; case 2: $im =imagecreatefromjpeg($image);

  • 0
$image='xiaofl.jpg';
$img=getimagesize($image);
switch ($img[2])
{
    case 1:
    $im =imagecreatefromgif($image);
    break;
    case 2:
    $im =imagecreatefromjpeg($image);
    break;
    case 3:
    $im =imagecreatefrompng($image);
    break;
}
$word=imagecolorallocate($im,212,0,0);
$str=iconv("gbk","utf-8","php100.com");
imagettftext($im,12,0,20,20,$word,'simkai.ttf',$str);

header("content-type: image/jpeg");
Imagejpeg($im);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T20:17:09+00:00Added an answer on May 12, 2026 at 8:17 pm

    There are a lot of ways to do this. You’ll generally want to decide on a single responsibility for each of your classes. Then you will code the class to meet that responsibility in as general a way as possible. In this case, the responsibility might be to display an image with some text added(?).

    Here’s one way to do it:

     $image='xiaofl.jpg';
     $imageDisplay = new ImageDisplay($image);
     $imageDisplay->show();
    
    
     class ImageDisplay
     {
    
         private $imageName;
    
         public function __construct($imageName)
         {
             $this->imageName = $imageName;
         }
    
         public function show()
         {
             $img=getimagesize($this->imageName);
             switch ($img[2])
             {
                 case 1:
                 $im =imagecreatefromgif($this->imageName);
                 break;
                 case 2:
                 $im =imagecreatefromjpeg($this->imageName);
                 break;
                 case 3:
                 $im =imagecreatefrompng($this->imageName);
                 break;
             }
             $word=imagecolorallocate($im,212,0,0);
             $str=iconv("gbk","utf-8","php100.com");
             imagettftext($im,12,0,20,20,$word,'simkai.ttf',$str);
    
             header("content-type: image/jpeg");
             Imagejpeg($im);
         }
    
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Image tag ( <img src= alt= /> ), line break tags ( <br />
Image img = new Image(); img.ImageUrl = images/sample1.jpg?rnd= + (new Random()).Next(); // added random
image caption <div class=btheme> <a href=/a3><img src=/a3.jpg /></a> <div class=caption> <div>image caption3</div> </div> </div>
Image describing the problem http://img215.imageshack.us/img215/3725/20100314235127schedule2.jpg I hope the image above can explain what I
Image tag inside email message: <img src=http://www.mydomain.com/image.php?lastest=1> Part of image.php script: case 'image/gif': header('Content-type:
image is at following location http://www.freeimagehosting.net/uploads/e50107df44.jpg please help me. i will be thank full
image = document.createElement(image); image.src =http://jsfiddle.net/img/logo.png; e = document.getElementById('id'); $(image).load(function() { $(image).hide(); e.appendChild(image); $(image).fadeIn(1000); });
Image http://img534.imageshack.us/img534/8542/aaagla.jpg It is good to give me a example (any language)
Image describing the tables -> https://i.stack.imgur.com/ki2YP.jpg Each of the tables is a model. Main
image.html - <img src=showImage.php?id=44/> <-- this is the code I'm trying to make work.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.