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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:31:20+00:00 2026-05-30T15:31:20+00:00

I am new to facebook app development and working over my first app. I

  • 0

I am new to facebook app development and working over my first app.
I am trying to resize an image using imagecopyresampled() function but getting this error for it:

Warning: imagecopyresampled(): supplied argument is not a valid Image resource in …

$url = "http://graph.facebook.com/{$userId}/picture?type=large";
$img = "udp.gif";
file_put_contents($img, file_get_contents($url));
if (exif_imagetype($img) != IMAGETYPE_GIF) {
    $imgFile = 'temp/' . $userId . '_fdp_' . rand() . '.gif';
    if (exif_imagetype($img) == IMAGETYPE_JPEG)
        $imageObject = imagecreatefromjpeg($img);
        if (exif_imagetype($img) == IMAGETYPE_PNG)
            $imageObject = imagecreatefrompng($img);
            $imagegif($imageObject, $imgFile);
            $imgFile1='temp/' . $userId . '_fdp_.gif';
            $imagecopyresampled($imgFile1, $imgFile, 0, 0, 0, 0, 200, 280, 180, 252);
            $img = $imgFile1;
         }
    }
}
  • 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-30T15:31:21+00:00Added an answer on May 30, 2026 at 3:31 pm

    You’re misunderstanding the argument types. resource is a PHP type, like string or float. Resources need to be created with the appropriate related function. In your case, you need one resource of the original image, created with a function like imagecreatefromjpeg, and another similar resource to copy the image to, most likely a blank image created with imagecreatetruecolor.

    To quote the example from the manual:

    $image_p = imagecreatetruecolor($new_width, $new_height);
    $image = imagecreatefromjpeg($filename);
    imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
    

    What you have instead is a non-existent variable and a string, which is not the required input.

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

Sidebar

Related Questions

Hello I am new to facebook app development and working over my first app.
Hello I am new to facebook app development and working over my first app.
I'm trying to upload an icon to a new Facebook app (iframe) but the
I have really simple few lines of Facebook app, using the new Facebook API:
I'm new to Facebook app development I hope I can get an answer here.
I'm new to FB app development. Once the user authorize my app, facebook does
I am developing my first facebook app, which includes creating a new album and
Im relatively new to iPhone development and Im trying to implement Facebook functions in
I am new to iphone app development, and I am trying to upload images
I am very new to facebook application development. In my facebook app I want

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.