Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $userphoto = $_FILES[foto];
- foreach($userphoto['name'] as $file_id => $file) {
- if ($file != NULL && (strstr(strtolower($file), '.jpg') || strstr(strtolower($file), '.png') || strstr(strtolower($file), '.gif'))) {
- $file = str_replace("'", "`", $file);
- $file = str_replace('"', '`', $file);
- $file = Rsafe($namep)."_".Rsafe($surname)."_".$code2."_".rand(111, 999).".jpg";
- $url = "../photos/".$file;
- if (move_uploaded_file($userphoto['tmp_name'][$file_id], $url)) {
- $data = GetImageSize($url);
- $mime = $data['mime'];
- $max_width = '600';
- $max_height = '600';
- if (($data[0] > $max_width) or ($height > $max_height)) {
- if ($data[0] > $max_width) {
- $width = $max_width;
- $height = $data[1]/($data[0]/$width);
- }
- if ($height > $max_height) {
- $height = $max_height;
- $width = $data[0]/($data[1]/$height);
- }
- $frame = ImageCreateTrueColor($width, $height);
- if ($mime == 'image/gif') {
- $im = ImageCreateFromGIF($url);
- }
- else if ($mime == 'image/png') {
- $im = ImageCreateFromPNG($url);
- }
- else if ($mime == 'image/jpeg') {
- $im = ImageCreateFromJPEG($url);
- }
- imagecopyresized ($frame, $im, 0, 0, 0, 0, $width, $height, $data[0], $data[1]);
- # Header('Content-type: image/jpeg');
- imagejpeg($frame, $url, 80);
- imagedestroy($frame);
- imagedestroy($im);
- }
- }
- mysql_query("INSERT INTO photos VALUES (NULL,'".$photoid."','".$photostatus[$file_id]."', '".$file."')") or die(mysql_error());
- }
- }?>
- <b><?=$lang['PHOTO']?> :</b> <input type=file name=foto[0]><input type="text" name="photostatus[0]"><br><?=$lang['main_picture_explication']?><p>
- <?=$lang['PHOTO']?> 1: <input type=file name=foto[1]><input type="text" name="photostatus[1]"><br>
- <?=$lang['PHOTO']?> 2: <input type=file name=foto[2]><input type="text" name="photostatus[2]"><br>
- <?=$lang['PHOTO']?> 3: <input type=file name=foto[3]><input type="text" name="photostatus[3]"><br>
- <?=$lang['PHOTO']?> 4: <input type=file name=foto[4]><input type="text" name="photostatus[4]"><p>
- <?=$lang['PHOTO']?> 5: <input type=file name=foto[5]><input type="text" name="photostatus[5]"><p>
- <?=$lang['PHOTO']?> 6: <input type=file name=foto[6]><input type="text" name="photostatus[6]"><p>
- <?=$lang['PHOTO']?> 7: <input type=file name=foto[7]><input type="text" name="photostatus[7]"><p>
- <?=$lang['PHOTO']?> 8: <input type=file name=foto[8]><input type="text" name="photostatus[8]"><p>
- <?=$lang['PHOTO']?> 9: <input type=file name=foto[9]><input type="text" name="photostatus[9]"><p>
- <?=$lang['PHOTO']?> 10: <input type=file name=foto[10]><input type="text" name="photostatus[10]"><p>
Add Comment
Please, Sign In to add comment