Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
join variable to a string
Old 03-05-2009, 07:09 AM join variable to a string
Novice Talker

Posts: 14
Trades: 0
PHP Code:
$imagefilename 'new';
$imagefilename '../userimages/'.$imagefilename.'2.jpg'
im trying to join a variable to a string, is the code above enough to do this?

my current output just excludes the variable in between the two strings?

thanks
grgprint is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-05-2009, 07:21 AM Re: join variable to a string
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Is "new" part of the file name or a folder?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-05-2009, 07:41 AM Re: join variable to a string
Novice Talker

Posts: 14
Trades: 0
'new' is the old image name
currently the image is being save as 2.jpeg into /userimages
but it should be new2.jpeg
grgprint is offline
Reply With Quote
View Public Profile
 
Old 03-05-2009, 07:54 AM Re: join variable to a string
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Ok
Your code should work in that case.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-05-2009, 07:59 AM Re: join variable to a string
Novice Talker

Posts: 14
Trades: 0
right ok, in that case ill look into the $_Get method too find any mistakes,

thanks for your help mate!
grgprint is offline
Reply With Quote
View Public Profile
 
Old 03-05-2009, 08:00 AM Re: join variable to a string
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
$_GET
PHP is case sensitive on variable names
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-05-2009, 08:10 AM Re: join variable to a string
Novice Talker

Posts: 14
Trades: 0
yeah thats how ive got it,
ill just show you abit more of my code:

variables passed
code.php?thumb=thumb.jpg&filename=userimages/picnik_exported_file123618638723548.jpg

so in the php im trying to crop the filename to just picnik_exported_file123618638723548
then add 3crop.jpg to the end of it
eg. 3picnikexportedfile123618638723548crop.jpg
but the image is save as 3crop.jpg

PHP Code:
$imagefilename $_GET['filename']; 
$imagefilename substr($imagefilename1135); 
$imagefilename rtrim($imagefilename); 
$imagefilename ereg_replace("[^A-Za-z0-9]"""$imagefilename);

 
$imagefilename '../userimages/3'.$imagefilename.'crop.jpg'
then further down im saving the image with:

PHP Code:
imagejpeg($dst_r$imagefilename); 
__________________

Please login or register to view this content. Registration is FREE

Last edited by grgprint; 03-05-2009 at 08:12 AM.. Reason: spelling mistake
grgprint is offline
Reply With Quote
View Public Profile
 
Old 03-05-2009, 09:05 AM Re: join variable to a string
Novice Talker

Posts: 14
Trades: 0
i sorted it, should have used the POST method,
thanks
__________________

Please login or register to view this content. Registration is FREE
grgprint is offline
Reply With Quote
View Public Profile
 
Old 03-05-2009, 09:47 AM Re: join variable to a string
anderswc's Avatar
Super Talker

Posts: 132
Name: Will Anderson
Location: Terre Haute, IN
Trades: 0
Haha, that mistake has cost me hours of frustration (over many projects).
__________________
Will Anderson

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
anderswc is offline
Reply With Quote
View Public Profile Visit anderswc's homepage!
 
Reply     « Reply to join variable to a string
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28920 seconds with 12 queries