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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:46:42+00:00 2026-06-04T12:46:42+00:00

I’m using simple gallery script which dynamically loads image when user clicks on thumbnail

  • 0

I’m using simple gallery script which dynamically loads image when user clicks
on thumbnail :

$(document).ready(function() {
$('.thumbnailB').live("click", function() {

$('#mainImage').hide();
    var i = $('<img />').attr('src',this.href).load(function() {
        $('#mainImage').attr('src', i.attr('src'));
        $('#imageWrap').css('background-image', 'none');
        $('#mainImage').fadeIn();
    });
    return false; 

here is script demo : http://www.micahcarrick.com/code/jquery-image-swap/index.html

and PHP which uses filename and then explode to display image properties under image :

// this variable has to contain current image when user clicks on thumbnail
$filename  = "          "; 
$fileinfo = explode("-", $filename);
echo $filename;
?>
<BR><strong>Filesize :</strong>
<?php 
echo $fileinfo[1]; 
?>
<?php
    $resolution=$fileinfo[2]; 
    $res = explode("x", $resolution);
    ?> <BR><strong> Width : </strong><?php echo $res[0]; ?>
        <BR><strong> Height : </strong><?php echo $res[1]; ?>
</div>

HTML :

<a href="/download/thumbnail/big/Photo01-310KB-500x381-thbig.png" class="thumbnailB">
<img src="/download/thumbnail/small/Photo01-310KB-500x381-thsmall.png" alt="Image 1"/>
</a>

<a href="/download/thumbnail/big/Photo02-328KB-500x353-thbig.png" class="thumbnailB">
<img src="/download/thumbnail/small/Photo02-328KB-500x353-thsmall.png" alt="Thumbnail 2"/>
</a>

<div id="imageWrap">
<img src="/download/thumbnail/big/Photo01-310KB-500x381-thbig.png" alt="Main Image" id="mainImage"/>
</div>

How to grab image name and pass it into $filename variable from Jquery to PHP ? 1) grab and send #mainImage image name when page is loaded and then 2) grab and send .thumbnailB image name each time user clicks on thumbnail

I have a lot of images – using Jquery/PHP explode to display image properties would save me from database input, photos will be stored on Amazon S3 that’s why information(image resolution) has to be encoded into filename or database.

  • 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-06-04T12:46:43+00:00Added an answer on June 4, 2026 at 12:46 pm

    Talking to a PHP script from JavaScript is done using AJAX. So you will have to make an ajax call to your PHP script using the “filename” as the parameter.
    The PHP script returns the image data which can be stored in an javascript variable and then displayed however you want it.

    filename= $('#imagetag').attr('src');
    $.ajax({
    type: "GET",
    url: "some.php",
    data: { file: filename }
    }).done(function( img_prop) {
    //code to display the image properties 
    //$('image-prop').html(img_prop);
    });
    

    For both 1) and 2) you can have to make a ajax call. So bind the mouse click to the jquery ajax call.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I am reading a book about Javascript and jQuery and using one of the
I am doing a simple coin flipping experiment for class that involves flipping a

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.