Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Web Design & Development
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory modem monitor motherboard network printer problem ram registry router security slow software sound toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
(PHP) Move image from one script to another

Reply  
Thread Tools
brethart's Avatar
Junior Member with 6 posts.
 
Join Date: Aug 2007
08-Feb-2010, 07:50 PM #1
(PHP) Move image from one script to another
Hi,

Sorry for the lame title and long post, but this is the only way I could describe my headache of a problem. I am a bit of a newb when it comes to PHP, but am starting to get the general idea(knowledge base is increasing anyway...).

I am building a social network using SocialEngine, and have completely customised the picture gallerys, and profile picture system(hence why I haven't posted this elsewhere).

Currently the system allows users to upload photos to an album, and seperately add their profile picture. I am about 70% of the way through integrating these 2 functions together, but have now hit a major problem. All files in question are attached in the zip!

So basically what I'm asking for is either advice on what I should be doing, or help(if your feeling really friendly) to actualy make the changes.

Line 117 of user_album_update.tpl (template file), this is what I have added to create a link which should generate "http://mysite.com/user_editprofile_photo2.php?photoid=./uploads_user/USERID/IMAGEID.jpg", which it does.

Generated by the following($file_orig is defined earlier on in the file as the current image url):

PHP Code:
<div style='float: left; padding-right: 10px;' id='profilephotomsg_{$files[files_loop].media_id}'><a href="user_editprofile_photo2.php?photoid={$file_orig}"><img src='./images/icons/profile_editphoto_dim16.gif' border='0' class='button'>{lang_print id=20000801}</a></div
I then need this "photoid" to be assigned in user_editprofile_photo2.php as the image file to move/crop/copy/edit etc INSTEAD of the script recieving an uploaded file as it was supposed to in its original format. This is where I am getting stuck, I have tried a million and one different variations, and have got nowhere. Just blankness where photos should be!


After adding the URL to assign the photoid=??, I tried to call that into user_editprofile_photo2.php by using the following code:

PHP Code:
$photo $_GET['photoid']; 
and then tried deleting the code that refers to $new_photo, and assigning $photo to $photo_newname.

No joy!

I have deleted the code from user_editprofile_photo2.tpl so it goes straight to the cropping procedure.

UvumiCrop-compressed.js is the photo cropping javascript, the other files are attached in a zip file below with user_editprofile_photo2.php being the original file that works for the profile picture upload:


The simple explanation of what I am trying to do is successfully "$_GET" or "$_POST" the "photoid" variable I have added a the URL. I then need to assign this to equal "$photo" which can then be used to move and edit the image.

I think I can take it from there...

Any help would be much appreciated, if I need to provide any more info, then please just ask.

Regards,

Kevin
Attached Files
File Type: zip profilepics.zip (8.5 KB, 8 views)
ehymel's Avatar
Senior Member with 660 posts.
 
Join Date: Aug 2007
Location: Texas
09-Feb-2010, 12:51 AM #2
You have explained the background of what you are doing very well, but you provided NO information about what is not working. If you have someone click a link that goes to page.php?var=value, then you should be able to $_GET['var'] and retrieve the value.

At what point are you having trouble? You just say "No joy!" but we need some details about what is going wrong.
__________________
E.
brethart's Avatar
Junior Member with 6 posts.
 
Join Date: Aug 2007
09-Feb-2010, 09:03 AM #3
sorry mate, i see your point! that was pretty dumb of me...

basically when they click the "Set as Profile Picture" button, it loads the url as it should, but the user_edit_profilephoto2.php file does not seem to be able to pick up the photo. It displays no picture at all.

I know the value of the variable is correct as I have physically copied it into the img src of the cropper.

Firstly I am not convinced the $_GET['var'] is working correctly, ands secondly I'm not convinced the script is correct to then convert the $_GET['var'] the way it needs to when and if it is working.

Thanks for your reply!
brethart's Avatar
Junior Member with 6 posts.
 
Join Date: Aug 2007
09-Feb-2010, 09:18 AM #4
I'll extend that last message...

Basically what user_edit_profilephoto2.php needs to do is use the $_GET['var'] to set the file location(instead of looking for an uploaded file that now doesn't exist), and then copy this file as $photo_newname. It should then proceed as it normally does to create the cropping image, and thumbnail, leaving the original file intact.
ehymel's Avatar
Senior Member with 660 posts.
 
Join Date: Aug 2007
Location: Texas
09-Feb-2010, 09:32 PM #5
I'm still not sure which part is not working, but then maybe you're not sure either, thus the question!

Have you tried something as simple as echo'ing the value just to make sure that is working, like:

Code:
$value = $_GET['var'];
echo $value;
Obviously if something that simple doesn't work, then nothing else will. Break the large problem into little small problems, then tackle those small problems one at a time, debugging like mad as you go.
__________________
E.
brethart's Avatar
Junior Member with 6 posts.
 
Join Date: Aug 2007
09-Feb-2010, 09:53 PM #6
Hi thanks for the response. I know exactly what I need to figure out and that is as follows:

The file user_editprofile_photo2.php has a part in the script that uploads a file, and then sends it to the cropper(after copying and creating a thumbnail).
I would like advise on how to remove the upload script and replace it and any dependancies the rest of the file has on it, with the variable sent over fro the $_GET command.

Any ideas?
ehymel's Avatar
Senior Member with 660 posts.
 
Join Date: Aug 2007
Location: Texas
09-Feb-2010, 10:46 PM #7
Quote:
Originally Posted by brethart View Post
Firstly I am not convinced the $_GET['var'] is working correctly,
This is what makes me ask my last question to you...

I'll have to look through more carefully to see if I can answer the rest. Hopefully someone else is looking too?
brethart's Avatar
Junior Member with 6 posts.
 
Join Date: Aug 2007
10-Feb-2010, 05:22 AM #8
OK Cheers mate! Whilst you have a look, I am going to start with a blank canvass so to speak and do as you suggested, one bit at a time...
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:50 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.