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

  • Home
  • SEARCH
  • 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 137895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:10:42+00:00 2026-05-11T07:10:42+00:00

I have a place holder image saying something like: Your rating is: [rating here]

  • 0

I have a place holder image saying something like:

Your rating is:    [rating here] 

My PHP code is supposed to dynamically insert the rating number where there is a blank space left out for it on the placeholder image. How can I do that?

  • 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. 2026-05-11T07:10:42+00:00Added an answer on May 11, 2026 at 7:10 am

    Here’s a an example how you could do it – use gd function calls to make your image, but play nice and cache the images. This sample plays even nicer by ensuring that if the browser already has the required image, it returns a 304…

    #here's where we'll store the cached images $cachedir=$_SERVER['DOCUMENT_ROOT'].'/imgcache/'  #get the score and sanitize it $score=$_GET['score']; if (preg_match('/^[0-9]\.[0-9]{1,2}$/', $score) {     #figure out filename of cached file     $file=$cachedir.'score'.$score.'gif';         #regenerate cached image     if (!file_exists($file))     {         #generate image - this is lifted straight from the php         #manual, you'll need to work out how to make your         #image, but this will get you started          #load a background image         $im     = imagecreatefrompng('images/button1.png');          #allocate color for the text         $orange = imagecolorallocate($im, 220, 210, 60);          #attempt to centralise the text           $px     = (imagesx($im) - 7.5 * strlen($score)) / 2;         imagestring($im, 3, $px, 9, $score, $orange);          #save to cache         imagegif($im, $file);         imagedestroy($im);     }      #return image to browser, but return a 304 if they already have it     $mtime=filemtime($file);      $headers = apache_request_headers();      if (isset($headers['If-Modified-Since']) &&          (strtotime($headers['If-Modified-Since']) >= $mtime))      {         // Client's cache IS current, so we just respond '304 Not Modified'.         header('Last-Modified: '.gmdate('D, d M Y H:i:s', $mtime).' GMT', true, 304);         exit;     }       header('Content-Type:image/gif');     header('Content-Length: '.filesize($file));     header('Last-Modified: '.gmdate('D, d M Y H:i:s', $mtime).' GMT');     readfile($file);   } else {     header('HTTP/1.0 401 Invalid score requested'); } 

    If you put this in image.php, you would use as follows in an image tag

    <img src='image.php?score=5.5' alt='5.5' /> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an HTML Mail template, with a place holder for the image. I
In my string I have place holders like: ##NEWSLETTER## , ##FOOTER# ##GOOGLEANALYTICS## etc. Each
I have a place holder for a profile photo.I want it to get profile
here is the problem I am having with placeholder: I have a repeater and
I have a perl script that's reading an INI file like this: [placeholder_title] Hostname
I would like to put a placeholder into e.g. the footer.html and have it
I have a website where the users can upload an image. However, before they
OK, assume I have a working database connection and table to insert a name
I have to place a flash movie into an existing layout. It is replacing
I have an image list in a list view where previously the only images

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.