0

i want a simple php code that will get data from user e.g( https :// fbcdn-profile-a.akamaihd.net/hprofile-ak-ash3/c0.0.180.180/s160x160/1525356_685076001544625_985694702_a.jpg) i want just this code from user from above example (1525356_685076001544625_985694702_a.jpg) when he will put all code into my website then my website will show him his/her large image.

-Note:i just want selective part(1525356_685076001544625_985694702_a.jpg) from user and show whole result like this - https : // fbcdn-profile-a.akamaihd.net/hprofile-ak-ash3/1525356_685076001544625_985694702_n.jpg

any help will be greatly appreciated...

Ali Mukhtar
  • 11
  • 1
  • 6
  • Seems to work fine. I just tested with a profile picture. If you can edit your code into the question, or open another question, I am sure you will get help! – Dave Chen Jan 14 '14 at 23:24
  • no man you are really nice please can u make php code whole as it is for me?? bcz i'm newbie sorry action=done.php please make complete done.php for me? plz? – Ali Mukhtar Jan 14 '14 at 23:28
  • I'm unsure what `done.php` is for. You already show the fullscreen picture on `profil.php`, what else is there to do? – Dave Chen Jan 14 '14 at 23:31
  • here it is mine link which is being created by me: http://itxjanu.tk/pic/ – Ali Mukhtar Jan 14 '14 at 23:32
  • You have to change form action to `http://itxjanu.tk/pic/done.php`. – Dave Chen Jan 14 '14 at 23:42
  • OMG!! its working fine now but it does not showing my pic there it gives me link:https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash3/1525356_685076001544625_985694702_n.jpg i want that user will get his/her image there not a link – Ali Mukhtar Jan 14 '14 at 23:44
  • Place `` tags around the image. `echo '';` – Dave Chen Jan 14 '14 at 23:47
  • last thing mate when i use $input = $_POST['resimbaglanti']; it does not show me anythng – Ali Mukhtar Jan 14 '14 at 23:49
  • Use `$input = $_POST['url']`, because that is what your input is named. – Dave Chen Jan 14 '14 at 23:54
  • i want to get user's data not a fix url :/ – Ali Mukhtar Jan 14 '14 at 23:55
  • It's not a fixed url, in your HTML, your input textfield is named `url`. Please try it and see if that works for you. If you mean getting the user's data from a facebook login button, that's a whole question on using facebook API and creating a facebook application. – Dave Chen Jan 14 '14 at 23:56
  • thank u man <3 no issue :) be my frnd please your personal email please? i will not tease u :) – Ali Mukhtar Jan 14 '14 at 23:58

2 Answers2

0

Try this:

<?php

$input = 'https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash3/c0.0.180.180/s160x160/1525356_685076001544625_985694702_a.jpg';

$code = explode('/', $input);
$code = $code[sizeof($code)-1];

$code = substr($code, 0, -5);

echo 'https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash3/' . $code . 'n.jpg';

Output:

https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash3/1525356_685076001544625_985694702_n.jpg
Dave Chen
  • 10,887
  • 8
  • 39
  • 67
  • thank u so much for helping me i'm gonna test it can u tell me one more thing? that is i need $input = (user's data not selective link you have just posted above) have a look please on this: http://www.profileviewer.comoj.com/ – Ali Mukhtar Jan 14 '14 at 22:56
  • The name for the input is `resimbaglanti`. Try `$input = $_POST['resimbaglanti'];`. – Dave Chen Jan 14 '14 at 22:57
  • let me try plz hold on thnks :) – Ali Mukhtar Jan 14 '14 at 22:59
0

In addition to @Dave Chen anwser (shorter).

 $input = 'https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash3/c0.0.180.180/s160x160/1525356_685076001544625_985694702_a.jpg';  

 $code = explode('/', $input);
 $code = substr(end($code), 0, -4);

 // or   version < PHP 5.4 
 $code = substr(end(explode('/', $input)), 0, -4);


 echo 'https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash3/' . $code . 'n.jpg';
voodoo417
  • 11,861
  • 3
  • 36
  • 40