/    Sign up×
Community /Pin to ProfileBookmark

Problem with resizing uploaded images

Hi there. I try to resize an uploaded picture with PHP and it worked previously, but somehow something changed and it stopped working. All I get is a crazy error I don’t understand.
Who can help me?

The part for resizing the image (uploading works) is this:

[code]83. $image_p = imagecreatetruecolor($breedte, $hoogte);
84. $image = imagecreatefromjpeg($plaatje);
85. $a = imagecopyresampled($image_p, $image, 0, 0, 0, 0, $breedte, $hoogte, $breedte_origineel, $hoogte_origineel);
86. $b = imagejpeg($image_p, $image, 100);
87. $c = imagedestroy($image_p);
88. echo ‘$image_p: ‘.$image_p.'<br>$image: ‘.$image.'<br>$a: ‘.$a.'<br>$b: ‘.$b.'<br>$c :’.$c;[/code]

And I get this error:
Warning: imagejpeg() [function.imagejpeg]: Unable to open ‘Resource id #10’ for writing: Permission denied in /Applications/MAMP/htdocs/beheer/nieuws/toevoegen.php on line 86
$image_p: Resource id #8
$image: Resource id #10
$a: 1
$b:
$c :1

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@VodkaProDrinkerFeb 26.2009 — Ask your server admin if he changed versions of php.

If he do, it's probably problem with the function, you need to use older/newer version.
Copy linkTweet thisAlerts:
@GrindauthorFeb 26.2009 — I run the server locally. So I'm the one who manages the server and nothing's changed.

But the script is correct?
Copy linkTweet thisAlerts:
@TopkatFeb 26.2009 — http://www.4wordsystems.com/php_image_resize.php

I used this tutorial to help me understand resizing uploaded images...
Copy linkTweet thisAlerts:
@NogDogFeb 26.2009 — The 2nd parameter to imagejpeg(), if provided, is the file name you want to save the image to. You are giving it a resource ID instead of a file path/name.
Copy linkTweet thisAlerts:
@GrindauthorFeb 26.2009 — The 2nd parameter to imagejpeg(), if provided, is the file name you want to save the image to. You are giving it a resource ID instead of a file path/name.[/QUOTE]

That's it! Thanks!
×

Success!

Help @Grind spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...