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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:00:03+00:00 2026-05-26T12:00:03+00:00

Problem: When designing the website I sometimes used width: xxx; on images. That way

  • 0

Problem: When designing the website I sometimes used width: xxx; on images. That way I was able to adjust the images. However, that creates overhead in size.

Solution: Automatically fetch all images which have a width: propery. Resize them to that :width property keeping the dimensions. Save the file as a .gif on the computer.

Does anyone know a good solution?

  • 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-26T12:00:04+00:00Added an answer on May 26, 2026 at 12:00 pm

    You can do it using GD (if you have GD or GD2 enabled on your php instalation)
    http://php.net/image

    <?php
        function resizeImage($image,$width=null,$height=null){
            if(!$width and !$height) return false;
            $info = getimagesize($image);
    
            if(!$height) $height = $width/$info[0]*$info[1];
            if(!$width) $width = $height/$info[1]*$info[0];
    
            $new = newEmptyImage($width, $height);
            $resource = imagecreatefromgif($image);
    
            imagecopyresampled($new,$resource,0,0,0,0,$width,$height,$info[0],$info[1]);
    
            return imagegif($new,$image);
        }
        function newEmptyImage($width,$height){
            $new = imagecreatetruecolor($width,$height);
            imagealphablending($new, false);
            imagesavealpha($new, true);
            $bg = imagecolorallocatealpha($new,0,0,0,127);
            imagefill($new,0,0,$bg);
    
            return $new;
        }
    ?>
    

    now you can simply call resizeImage("example.gif",120);

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

Sidebar

Related Questions

I've made a simple website that is entirely scale-able...except the images. the body and
I'm designing a comment service that will plug and play with any website that
I'm designing a website that is going to have multiple nested divs for the
Does anyone have some guidelines or links to articles when designing a website that
I'm designing a database that will be the backend for a marketplace website. There
i am designing a database which will be used for a website used to
I am designing a photography website for a client. The client requested that I
I'm in the process of designing a website that is built around the concept
After designing and coding a standards-compliant website, that works functionally in normal browsers (Firefox,
So here is my problem: I am designing a website for my project. So

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.