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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:43:52+00:00 2026-05-30T01:43:52+00:00

I am building a custom wordpress theme and have a slideshow on the front

  • 0

I am building a custom wordpress theme and have a slideshow on the front page displaying images from blog posts.

Now if the image is over 300px in height I want to force its widthand center it vertically. So my question is:

Is there a way, in php or javascript to get the height of an image by only using the URL of the image?

EDIT: I tried this: <?php list($height) = getimagesize(echo catch_that_image()); echo "<p>$height</p>"; ?> where catch_that_image() returns the URL, but somehow this doesn’t work (I think the first echo breaks it). Any ideas?

Thank you for your help.

  • 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-30T01:43:52+00:00Added an answer on May 30, 2026 at 1:43 am

    image by only using the URL of the image?

    var img = new Image();
    img.onload = function() {
        alert('The size is ' + this.width + 'x' + this.height);
    };
    img.src = 'some image URL';
    

    Try it
    http://jsfiddle.net/NPSMN/

    ps:

    I tried this: … where
    catch_that_image() returns the URL, but somehow this doesn’t work (I
    think the first echo breaks it). Any ideas?

    did you look closer at your code? echo outputs to the browser, not to the argument of the function.

    <?php 
    list(,$height) = getimagesize(catch_that_image()); 
    echo "<p>$height</p>"; 
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read several documentations about building custom ErrorHandler (by inheriting from IErrorHandler). Unfortunately,
Here I have pasted link for code: http://blog.asolutions.com/2010/09/building-custom-map-annotation-callouts-part-1/ In this code I have just
I am building a child theme in Wordpress that needs some custom functionality (for
I am building a new WordPress theme using register_post_type to create a custom post
I asked a question about building custom Thread Safe Generic List now I am
I'm building a custom Ubuntu kernel and have modified one of the source files.
I'm building a custom RTE that converts user input to a homebrewn markup, now
I'm building a custom options panel in Wordpress. One of the options I'd like
I'm building a large custom search for a wordpress site that is functioning as
I am using the code at http://mindtherobot.com/blog/272/android-custom-ui-making-a-vintage-thermometer/comment-page-1/#comment-14326 for building custom view. I wanted to

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.