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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:54:19+00:00 2026-05-30T02:54:19+00:00

I currently use phpthumb to generate thumbnails for profile pictures. http://phpthumb.gxdlabs.com/ This is my

  • 0

I currently use phpthumb to generate thumbnails for profile pictures. http://phpthumb.gxdlabs.com/

This is my current method:

<?php
$path_to_profile_pic = '../icons/default.png';
$profile_pic = file_get_contents('icons/default.png');
$small_profile_pic = PhpThumbFactory::create($profile_pic, array(), true);
$small_profile_pic->adaptiveResize(25, 25);
$small_profile_picAsString = $small_profile_pic->getImageAsString();
?>
<img src="data:image/png;base64,<?php echo base64_encode($small_profile_picAsString); ?>" width="25" height="25" />

However, this is very slow due to base64 because it generates a large number of text in your code. What is the best way to use phpthumb to generate thumbnails?

Edit

Is there a way to do it without saving another image since it would consume more space?

  • 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-30T02:54:21+00:00Added an answer on May 30, 2026 at 2:54 am

    You’re better off always generating thumbnail versions of images on upload/creation instead of trying to serve them through php scripts on-demand. You can cache generated files to the filesystem with php using some of your code but that’s still much slower than serving them up with apache.

    If you’re unable to create thumbnails on upload/create you can optimize your current implementation by caching the scaled down thumbnail to the filesystem and serving them up for every subsequent request:

    <?php
    $path_to_thumb_pic = '../icons/default_thumb.png';
    if (!file_exists($path_to_thumb_pic)) {
      $path_to_profile_pic = '../icons/default.png';
      $profile_pic = file_get_contents('icons/default.png');
      $small_profile_pic = PhpThumbFactory::create($profile_pic, array(), true);
      $small_profile_pic->adaptiveResize(25, 25);
      $small_profile_pic->save($path_to_thumb_pic);
    }
    ?>
    
    <img src="<?php echo $path_to_thumb_pic; ?>" width="25" height="25" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We currently use VSS 6, this is not going to change I am afraid.
I currently use FixedThreadPool to download images from the web, like this: ExecutorService mThreadPool
I currently use this code to find gcd and lcm def gcd(a, b): while
I currently use .htaccess and PHP to parse URLs in the following way: URL
I currently use this code in power shell: $TrustAll=$TAAssembly.CreateInstance(Local.ToolkitExtensions.Net.CertificatePolicy.TrustAll) [System.Net.ServicePointManager]::CertificatePolicy=$TrustAll How can I do
I currently use this style to create a js class like structure: var JSClass
We currently use this logic to center every new window: ASSIGN {&WINDOW-NAME}:X = (SESSION:WIDTH-PIXELS
I currently use this function to wrap executing commands and logging their execution, and
I currently use the following method to set the colour of my Row Background.
I currently use the following code to print a double: return String.format(%.2f, someDouble); This

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.