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 517169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:48:23+00:00 2026-05-13T07:48:23+00:00

I have a 1 pixel tall by 760 pixel wide image that I use

  • 0

I have a 1 pixel tall by 760 pixel wide image that I use as a repeating vertical background image. The right side of this image is filled with a spot color (the remaining left side of the image is white).

The purpose of this background image, in my css based layout, is that it provides the illusion that the sidebar background color runs all the way down the page (easy to do with tables, but no so much with CSS positioning).

What I need to do is to figure a way to feed a php script (background-image.php) which contains the imagecreatefromgif function, a hex number and have it use that to repaint the spot color of the image to match the spot color that’s passed in and save the resulting image onto the server, overwriting the default one.

Ideally, I’d not like to have to call this function everytime the template loads, and onlydo it when the user elects to change the template colors. So once they do that, I’d just like to modify the existing image I’ve got on the server which will always be called “sidebar_bg.gif”

Any ideas on how to do this are much appreciated.

  • 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-13T07:48:24+00:00Added an answer on May 13, 2026 at 7:48 am

    Something like this could do it:

    $token = md5(serialize(array($red, $green, $blue)));
    
    if (!file_exists('cachedir/'.$token.'.gif')) 
    {
        $img = imagecreatefromgif('origfilename.gif');
    
        $color = imagecolorallocate($img, $red, $green, $blue);
    
        for ($i = $startPixel-1; $i < $endPixel; $i++)
        {
            imagesetpixel($img, $i, 0, $color);
        }
    
        imagegif($img, 'cachedir/'.$token.'.gif');
    }
    
    serveFile($token);
    

    EDIT: Added caching to example code

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PNG image that has an unsupported bitmap graphics context pixel format.
I have a canvass that is 200 pixels wide and 100 pixels tall. I
I have a 640px wide, 208px tall PNG that I've placed in my /drawable
Basically on GunChester my project I have an few pixel wide gap between #login_top
I have an array that contains the RGB colour values for each pixel in
I have an image and want to read the pixel values in a particular
I have a memory buffer corresponding to my screen resolution (1280x800 at 24-bits-per-pixel) that
I have an object of the type System.Drawing.Image and want to make every pixel
The project I'm working on has a massive background image (800px wide by 2585px
I've created a small pixel-font that I want to use in a Flash game.

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.