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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:45:42+00:00 2026-05-20T12:45:42+00:00

I use getimagesize to judge an image height and size. When a url has

  • 0

I use getimagesize to judge an image height and size.

When a url has space, the getimagesize echo’s an error. I’ve tried using urlencode() to transfer all the url address, it still returns an error. I noticed that if I just change the space into %20, getimagesize runs ok.

I have no idea why?

I also tired to use $newurl = preg_replace(' ', '%20', $url); It echo’ed :

Warning: preg_replace() [function.preg-replace]: Empty regular expression

So how to preg_replace correctly. And is there a way to transfer the url correctly with getimagesize so that it passes all possible test cases.

Thanks

  • 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-20T12:45:43+00:00Added an answer on May 20, 2026 at 12:45 pm

    you should use str_replace(' ', "%20", $url) instead of preg_replace(' ', '%20', $url);

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

Sidebar

Related Questions

I would like to show an image on a screen, and it's size (Height
I tried to use getimagesize() on an SVG file, but it failed. I know
Does getimagesize use an extra HTTP request or can it find out the size
I get the width and height of image with getimagesize function, like below: list($width,$height)
I could use getimagesize() to validate an image, but the problem is what if
I am using getimagesize in PHP to get information about an image in my
I am trying to get image size (image dimensions, width and height) of hundreds
I'm trying to use an image from a URL with Kohana image class. http://kohanaframework.org/3.0/guide/api/Image
How can I check for height and width before uploading image, using PHP. Must
I've tried to use the PHP function getimagesize , but I was unable 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.