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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:40:26+00:00 2026-05-23T16:40:26+00:00

I want to dynamically generate thumbnails, and I found from one of posts here

  • 0

I want to dynamically generate thumbnails, and I found from one of posts here a recommendation that uses SimpleImage class, it is usage like this:

header('Content-Type: image/jpeg');
include('SimpleImage.php');
$image = new SimpleImage();
$image->load('picture.jpg');
$image->resizeToWidth(150);
$image->output();

and the output method is as following:

function output($image_type=IMAGETYPE_JPEG) {

    if( $image_type == IMAGETYPE_JPEG ) {
       imagejpeg($this->image);

    } elseif( $image_type == IMAGETYPE_GIF ) {
       imagegif($this->image);

    } elseif( $image_type == IMAGETYPE_PNG ) {
       imagepng($this->image);

    }
}

this works fine with outputing images, because I received something like binary code on client side. but what I want is a thumbnail slider, so I need all image to be in a <ul></ul>, I tried this using ajax:

updated

function thumb($files){
    echo '<ul>';
    foreach($files as $file){
        $thumb = new Thumbnail();
        $thumb->load($file->getFilePath());
        $thumb->resizeToWidth(80);
        echo '<li>'.$thumb->output().'</li>';
    };
    echo '</ul>';
}

but this does not seem to work. how can I get output something like this so I can do a slider gallery.

<ul>
  <li><img src="path here"></li>
  <li><img src="path here"></li>
</ul>
  • 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-23T16:40:26+00:00Added an answer on May 23, 2026 at 4:40 pm

    You’re confusing two things: html layout of images and the scaling of images. You need to keep your scaling code – which is perfectly fine – in a separate php file, say, scale.php – like this:

    <?php
        header('Content-Type: image/jpeg');
        include('SimpleImage.php');
        $image = new SimpleImage();
        $image->load($_GET['image']);
        $image->resizeToWidth(150);
        $image->output();
    ?>
    

    And in your main php, you’ll have a code like this:

    <?php
        echo '<ul>';
        foreach($files as $file){
            echo '<li><img src="scale.php?image=' . $file . '"/></li>';
        }
        echo '</ul>';
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to load one or more DLLs dynamically so that they run with
So I want to dynamically generate a MIDI file on a web request.Coming from
In my JSF/Facelets application, I want to dynamically generate a breadcrumb trail from a
I want to write a program in C/C++ that will dynamically read a web
In my XAML I want to dynamically generate a ListBox with the following: <ListBox
I have a scenario where i want to dynamically generate a python script -
Given a String list val www = List(http://bloomberg.com, http://marketwatch.com); I want to dynamically generate
I want to dynamically hide/show some of the columns in a NSTableView, based on
I want to dynamically get the name of the current stored procedure inside itself
At run time I want to dynamically build grid columns (or another display layout)

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.