[PHP] Avatar uploaden

Gestart doorJosnl21 reacties98 weergaven

22 berichten · pagina 2 van 2

Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hmm.. Okesmile
Ik heb nu dit script (met bijbehorende class van exact 5000 volle regels emo):

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/require_once"]require_once[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]class.upload.php[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$foo[/COLOR] [COLOR= #007700]= new[/COLOR] Upload[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]avatar[/COLOR][COLOR= #007700]]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$foo[/COLOR][COLOR= #007700]->[/COLOR]uploaded[COLOR= #007700]) {[/COLOR]
  [COLOR= #FF8000]// save uploaded image with no changes[/COLOR]
  [COLOR= #0000BB]$foo[/COLOR][COLOR= #007700]->[/COLOR]Process[COLOR= #007700]([/COLOR][COLOR= #DD0000]public_html/msf/images/avatar[/COLOR][COLOR= #007700]);[/COLOR]
  [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$foo[/COLOR][COLOR= #007700]->[/COLOR]processed[COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]original image copied[/COLOR][COLOR= #007700];
  }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]error : [/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$foo[/COLOR][COLOR= #007700]->[/COLOR]error[COLOR= #007700];
  }[/COLOR]
  [COLOR= #FF8000]// save uploaded image with a new name[/COLOR]
  [COLOR= #0000BB]$foo[/COLOR][COLOR= #007700]->[/COLOR]file_new_name_body [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]foo[/COLOR][COLOR= #007700];[/COLOR]
  [COLOR= #0000BB]$foo[/COLOR][COLOR= #007700]->[/COLOR]Process[COLOR= #007700]([/COLOR][COLOR= #DD0000]public_html/msf/images/avatar[/COLOR][COLOR= #007700]);[/COLOR]
  [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$foo[/COLOR][COLOR= #007700]->[/COLOR]processed[COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]image renamed "foo" copied[/COLOR][COLOR= #007700];
  }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]error : [/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$foo[/COLOR][COLOR= #007700]->[/COLOR]error[COLOR= #007700];
  }[/COLOR]
  [COLOR= #FF8000]// save uploaded image with a new name,
  // resized to 100px wide[/COLOR]
  [COLOR= #0000BB]$foo[/COLOR][COLOR= #007700]->[/COLOR]file_new_name_body [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]image_resized[/COLOR][COLOR= #007700];[/COLOR]
  [COLOR= #0000BB]$foo[/COLOR][COLOR= #007700]->[/COLOR]image_resize [COLOR= #007700]=[/COLOR] true[COLOR= #007700];[/COLOR]
  [COLOR= #0000BB]$foo[/COLOR][COLOR= #007700]->[/COLOR]image_convert [COLOR= #007700]=[/COLOR] gif[COLOR= #007700];[/COLOR]
  [COLOR= #0000BB]$foo[/COLOR][COLOR= #007700]->[/COLOR]image_x [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]125[/COLOR][COLOR= #007700];[/COLOR]
  [COLOR= #0000BB]$foo[/COLOR][COLOR= #007700]->[/COLOR]image_ratio_y [COLOR= #007700]=[/COLOR] true[COLOR= #007700];[/COLOR]
  [COLOR= #0000BB]$foo[/COLOR][COLOR= #007700]->[/COLOR]Process[COLOR= #007700]([/COLOR][COLOR= #DD0000]public_html/msf/images/avatar[/COLOR][COLOR= #007700]);[/COLOR]
  [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$foo[/COLOR][COLOR= #007700]->[/COLOR]processed[COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]image renamed, resized x=100
          and converted to GIF[/COLOR][COLOR= #007700];[/COLOR]
    [COLOR= #0000BB]$foo[/COLOR][COLOR= #007700]->[/COLOR]Clean[COLOR= #007700]();
  }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]error : [/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$foo[/COLOR][COLOR= #007700]->[/COLOR]error[COLOR= #007700];
  }
}[/COLOR] ?>


Alleen wat moet ik bij $foo->Process(); neerzetten als het plaatje moet komen op www.domein.nl/msf/images/avatar?
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Daar moet je de locatie zetten waar naar hij geupload moet worden.
0
Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ja, dat snap ik, maar als ie in msf/images/avatar moet komen, wat moet ik er dan neerzetten?bloos
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
$foo->Process(msf/images/avatar);


En ook nog CHMODDEN.
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
@Shahiem: vergeten

$foo->Process(msf/images/avatar);
0
Josnl

Lid · Topicstarter

Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Danke f¨¹r die Antworte Jungens!yummie
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Luukvdo schreef:
@Shahiem: vergeten

$foo->Process(msf/images/avatar);
Kuch kuch, wist ik wel push
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren