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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:56:19+00:00 2026-05-16T23:56:19+00:00

I have a image gallery, my requirement is to apply diffrent image sizes to

  • 0

I have a image gallery, my requirement is to apply diffrent image sizes to all image
my html markup is

<div class="post-attacthe-img"> 
<ul>
<li><a><img src="1.png"/></a></li>
<li><a><img src="2.png"/></a></li>
<li><a><img src="3.png"/></a></li>
<li><a><img src="4.png"/></a></li>
<li><a><img src="5.png"/></a></li>
<li><a><img src="6.png"/></a></li>
<li><a><img src="7.png"/></a></li>
<li><a><img src="8.png"/></a></li>
<li><a><img src="9.png"/></a></li>
<li><a><img src="10.png"/></a></li>

</ul>
</div>

Example like:
1 image if its size is 500X500, 2 image is 200X200,
again
3 image is 200X200, 4 image is 500X500
5 image is again 500X 500 and 6 image is 100X100, 7 Image is 100X100
Now again
8 image is 100X100, 9 Image is 100X100, 10 image is 500X500

Now the problem is i have to apply it timbthub.php which is a image resizing script.

  • 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-16T23:56:20+00:00Added an answer on May 16, 2026 at 11:56 pm
    function viewResize($img_path,$maxwidth,$maxheight){
            $img_array = @getimagesize($img_path);
            if(is_array($img_array)){
                list($orig_width, $orig_height, $type)=$img_array;           
                if ($orig_width > $maxwidth){
                    $h = $maxwidth * ($orig_height / $orig_width);
                    $w = $maxwidth;
                    if($h>$maxheight){
                        $h = $maxheight;
                        $w = $maxheight * ( $orig_width / $orig_height);
                    }
                }
                elseif($orig_height > $maxheight){
                    $h = $maxheight;
                    $w = $maxheight * ($orig_width / $orig_height);
                    if($w>$maxwidth){
                        $h = $maxwidth * ($orig_height / $orig_width);
                        $w = $maxwidth;
                    }
                }
                else{
                    $w = $orig_width;
                    $h = $orig_height;    
                }
                $resize = array();
                $resize['w']=floor($w);
                $resize['h']=floor($h);
                return $resize;
            }
            else{
                return FALSE;
            }
    }
    

    usage:

    <?php 
    $dimensions = viewResize('foto.jpg','120','120');
    echo "<img src='foto.jpg' style='width:"$dimensions['w']"px;height:".$dimensions['h']."px;' alt='foto'/>";
    ?>
    

    if I understand ….

    <?php
    foreach($fotos_array as $foto){
        $dimensions = viewResize($foto,'120','120');
        echo "<img src='$foto' style='width:"$dimensions['w']"px;height:".$dimensions['h']."px;' alt='foto'/>";     
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a vertical image gallery of this sort: <div class=image-container> <div class=nav> <div
I have been creating an image gallery with jQuery, all is done. The images
I have an image gallery and I dont want give an extra class to
I have made a php image gallery, which should list all the subdirectories of
I have a requirement in that I want to implement an image gallery with
I have a custom image gallery which populates a div with thumbnails, each contained
All lightbox scripts have the image gallery option which are built like this: <a
I have an image gallery that I created by reading the contents inside a
I have an image gallery app that has a slider to control the width
I have a image gallery like Google+ or Facebook and i want to avoid

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.