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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:23:02+00:00 2026-06-15T12:23:02+00:00

Problem: getimagesize() does not work for some URLs, especially ones that are redirecting. I

  • 0

Problem: getimagesize() does not work for some URLs, especially ones that are redirecting.

I googled around and checked stackoverflow but to no avail.

Here’s what I see on my local machine:

var_dump(getimagesize('http://gan.doubleclick.net/gan_impression?lid=41000000015155731&pubid=21000000000506299&lsrc=17'));

> Array
(
    [0] => 120
    [1] => 90
    [2] => 2
    [3] => width="120" height="90"
    [bits] => 8
    [channels] => 3
    [mime] => image/jpeg
)

and on my server:

var_dump(getimagesize('http://gan.doubleclick.net/gan_impression?lid=41000000015155731&pubid=21000000000506299&lsrc=17'));

> bool(false)

I tried other images and URLs, and they work fine. It’s this URL that is giving me a problem. I also tried the following (on my server), and this does work:

echo strlen(file_get_contents('http://gan.doubleclick.net/gan_impression?lid=41000000015155731&pubid=21000000000506299&lsrc=17'));

> 4829 // This number means it works

The error log has nothing, and there is no other hints I can tell. I’m guessing it’s something that needs to change in the php.ini

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

    If file_get_contents works then definitely fopen would work

    Curl would have been the best option since you are having permission issue but you can also use FastImage .. to read the image headers and get the information instead of having to save the whole file locally

    Example

    $img = new FastImage("http://gan.doubleclick.net/gan_impression?lid=41000000015155731&pubid=21000000000506299&lsrc=17");
    var_dump($img->getSize(),$img->getType());
    

    Output

    array (size=2)
      0 => int 120
      1 => int 90
    string 'jpeg' (length=4)
    

    Simple Demo

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

Sidebar

Related Questions

I have a script that performs some simple editing which works fine, the problem
Problem: I have a table that prints out vertical but I would like it
Problem occured when i tried to display xml data that has been taken by
We have a set of images, around 2500, that are stored in a local
I have the following code that I use to resize some images on my
I'm running getimagesize() to determine whether or not an uploaded file is a valid
What you see below is a part of my script. The problem is that
Problem is that when I exec sql insert query (I'm using Qt Creator and
I could use getimagesize() to validate an image, but the problem is what if
I use this class to upload images on my server. The problem is that

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.