/    Sign up×
Community /Pin to ProfileBookmark

Tidy up my Images

I have a list of 10 small images that facilitate the background assembly for a captcha PHP script. It would be good to put all the background images in a folder out of view.

The line of script is as follows:

$image = imagecreatefromjpeg(“background$bgNum.jpg”);

I have tried putting the images in a folder called ‘album’ and [B]amending[/B] the script as follows:

$image = imagecreatefromjpeg(” [B]./album/[/B] background$bgNum.jpg”);

It did not work. Am I on the right track???

Regards

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@WonDer9Jul 30.2011 — you have to use ".." for an above directory. and "/" for below( or inside folder).

So if your trying to grab images form a folder within you directory it has to be :
<i>
</i>$image = imagecreatefromjpeg("/album/background$bgNum.jpg");

or

$image = imagecreatefromjpeg("album/background$bgNum.jpg");


If its a folder in a directory above the folder containing the file to handle the image it is :
<i>
</i>$image = imagecreatefromjpeg("../album/background$bgNum.jpg");

just 2 dots: ".."


++ so if your html or php file is inside a folder trying to get to a folder out side used the second.

++ if your html orr php file is in the main trying to retrieve from a folder use the first.

++ PHP dosen't always care about white spaces but try not to leave it between arears of type.
Copy linkTweet thisAlerts:
@webiterauthorJul 31.2011 — Thanks WonDer9, that worked a treat. Thanks also for detailing the options.
Copy linkTweet thisAlerts:
@WonDer9Aug 01.2011 — cool just wanted to be specific.
×

Success!

Help @webiter 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.28,
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,
)...