/    Sign up×
Community /Pin to ProfileBookmark

imagerotate() binary string

[code=php]$originalPic = imagecreatefromstring ($aBinaryImageString);
$picTempDir = ‘../LoggedIn/Temp/pic.jpg’;
$angle = 90.0;
$originalPicRotated= imagerotate($originalPic, $angle, 0);
imageJPEG($originalPicRotated, $picTempDir,100);
$fPic = fopen($picTempDir, ‘r’);
$binaryPic = fread($fPic, filesize($picTempDir));
$binaryPic = addslashes($binaryPic);
fclose($fPic);[/code]

The above code is supposed to take an image stored as a binary string, rotate it 90 degrees and save it back as another binary string…

For some reason the code works on my testing server but when I try to run it on my host, it stops at line 4… Do any of you have any suggestions as to what the problem may be- or maybe a better way of writing the code?
The hosting company claims that their imagerotate() function is working properly and they have standard php5…

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@bokehMar 24.2007 — It's probably a directory permission issue on the imageJPEG line. You don't need all that crap with files anyway.[code=php]<?php

$originalPic = imagecreatefromstring ($aBinaryImageString);
$angle = 90.0;
$originalPicRotated = imagerotate($originalPic, $angle, 0);
ob_start();
imageJPEG($originalPicRotated, null, 100);
$binaryPic = addslashes(ob_get_clean());
// imagedestroy() here!

?>[/code]
Copy linkTweet thisAlerts:
@j-kizzleauthorMar 24.2007 — I don't know- bokeh, your code also works on my testing server but stops on line 3 on my testing server. HERE is the phpinfo() for my testing server...

I use code similar to this to debug:
[code=php]<?php

$originalPic = imagecreatefromstring ($aBinaryImageString);
$angle = 90.0;

//DEBUG
$var = "Before imagerotate()";
echo '<SCRIPT>alert("';
echo $var;
echo '");</SCRIPT>';
//END DEBUG

$originalPicRotated = imagerotate($originalPic, $angle, 0);

//DEBUG
$var = "After imagerotate()";
echo '<SCRIPT>alert("';
echo $var;
echo '");</SCRIPT>';
//END DEBUG

ob_start();
imageJPEG($originalPicRotated, null, 100);
$binaryPic = addslashes(ob_get_clean());
// imagedestroy() here!

?>[/code]
Copy linkTweet thisAlerts:
@bokehMar 24.2007 — If you know it stops on line 3 it might be helpful to post the whole error message.
×

Success!

Help @j-kizzle 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.12,
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,
)...