Autor | Zpráva | ||
---|---|---|---|
Jaroslav Šour Profil * |
#1 · Zasláno: 9. 1. 2013, 12:41:28
Dobrý den,
používám na webu renamer.php . Tento soubor uloří obrázek např 1.png, 2.png, 3png atd... Problem je že on ukládá ty obrázky jako 1png, 2png, 3png... Kam mám vložit tu tečku aby se tam udělala? Mockrát děkuji za odpověď. Kód je: <html> <body bgcolor="white"> <?php include("../inc_common.php"); $users = file($user_data_file); for ($i=0;$i<count($users);$i++) { list($u_id,$nickname,$bla_bla) = explode("\t",$users[$i]); $nickname = strtolower($nickname); @rename($nickname.".big.jpg","".$u_id.".big.jpg"); @rename($nickname.".big.gif","".$u_id.".big.gif"); @rename($nickname.".jpg","".$u_id.".jpg"); @rename($nickname.".gif","".$u_id.".gif"); echo "$u_id -- $nickname finished<br>\n"; flush(); } ?> </body> </html> |
||
Jan Tvrdík Profil |
Jaroslav Šour:
Ta tečka je na správném místně. Problém bude pravděpodobně někde úplně jinde. Už proto, že tenhle skript s *.png obrázky vůbec nepracuje.
|
||
Jaroslav Šour Profil * |
#3 · Zasláno: 9. 1. 2013, 12:52:30
A co když ji tam někam přidám. Bude to ukládat 1.png? Kam by jste ji dal?
|
||
Jan Tvrdík Profil |
#4 · Zasláno: 9. 1. 2013, 12:55:34
Jaroslav Šour:
Ten skript nepracuje s png obrázky. Tedy neprovádí tu popisovanou činnost („on ukládá ty obrázky jako 1png, 2png, 3png“). |
||
Jaroslav Šour Profil * |
#5 · Zasláno: 9. 1. 2013, 13:05:12
A mohlo by to bejt někde tady? Jste moc hodnej že mi pomáháte děkuji Vám mnohokrát.
#saving users photos #not really good. #I have also version which uses GD-library #but it's not clear for me now, should I include it here or not. #'cause it's not easy to determine which gd-functions are supported by ISP if ($big_photo_name != "" and $big_photo_name != "none") { if ($big_photo_size > $max_photo_size && $max_photo_size > 0) echo str_replace("~", $max_photo_size, str_replace("*", $big_photo_size,$w_too_big_photo))."<br>\n"; else { $photo_sizes = getimagesize($big_photo); if ($photo_sizes[2]<1 || $photo_sizes[2]>3) echo $w_invalid_image."<br>\n"; else { $new_file_name = "".$is_regist.".big.". (($photo_sizes[2] == 1)? "gif": ($photo_sizes[2] == 2) ? "jpg":"png" ); if ($photo_sizes[0] > $max_photo_width && $max_photo_width > 0) echo str_replace("~", $max_photo_width, str_replace("*", $photo_sizes[0],$w_too_big_photo_width))."<br>\n"; else if ($photo_sizes[1] > $max_photo_height && $max_photo_height > 0) echo str_replace("~", $max_photo_height, str_replace("*", $photo_sizes[1],$w_too_big_photo_height))."<br>\n"; else { move_uploaded_file ($big_photo, $photo_base_path.$new_file_name); @chmod($photo_base_path.$new_file_name, 0644); } }//end of 'image is valid' }//end of 'big_photo_size is ok' } if ($small_photo_name != "" and $small_photo_name != "none") { if ($small_photo_size > $max_avatar_size && $max_avatar_size > 0) echo str_replace("~", $max_avatar_size, str_replace("*", $small_photo_size,$w_too_big_avatar))."<br>\n"; else { $photo_sizes = getimagesize($small_photo); if ($photo_sizes[2]<1 || $photo_sizes[2]>3) echo $w_invalid_image."<br>\n"; else { $new_file_name = "".$is_regist. (($photo_sizes[2] == 1)? "gif": ($photo_sizes[2] == 2) ? "jpg":"png" ); if ($photo_sizes[0] > $max_avatar_width && $max_avatar_width > 0) echo str_replace("~", $max_avatar_width, str_replace("*", $photo_sizes[0],$w_too_big_photo_width))."<br>\n"; else if ($photo_sizes[1] > $max_avatar_height && $max_avatar_height > 0) echo str_replace("~", $max_avatar_height, str_replace("*", $photo_sizes[1],$w_too_big_photo_height))."<br>\n"; else { move_uploaded_file ($small_photo, $photo_base_path.$new_file_name); @chmod($photo_base_path.$new_file_name, 0644); $new_small_image = floor($is_regist/2000)."/".$new_file_name; } }//end of 'image is valid' }//end of 'small_photo_size is ok' } $fields_to_update[0][0] = USER_AVATAR; $fields_to_update[0][1] = $new_small_image; $fields_to_update[1][0] = USER_GENDER; $fields_to_update[1][1] = intval($sex); include($engine_path."user_din_data_update.php"); $current_user->surname = htmlspecialchars($surname); $current_user->firstname = htmlspecialchars($firstname); $current_user->city = htmlspecialchars($city); $current_user->about = htmlspecialchars($comments); $current_user->about = str_replace("\n","<br>", $current_user->about); $current_user->email = htmlspecialchars($email); $current_user->url = htmlspecialchars($url); $current_user->icquin = htmlspecialchars($icquin); //0 means no value $day = intval($day); $current_user->b_day = ($day<0||$day>31) ? 0:$day; $month = intval($month); $current_user->b_month = ($month<0||$month>12) ? 0:$month; $year = intval($year); $current_user->b_year = ($year<1900||$year>(date("Y")-3)) ? 0:$year; $sex = intval($sex); $current_user->sex = ($sex<0||$sex>2) ? 0:$sex; include($ld_engine_path."user_info_update.php"); include($file_path."designes/".$design."/user_info_update.php"); ?> |
||
Tori Profil |
#6 · Zasláno: 9. 1. 2013, 14:22:24
ř.15:
$new_file_name = "".$is_regist.".big.".
ř.42: $new_file_name = "".$is_regist.
|
||
Jaroslav Šour Profil * |
#7 · Zasláno: 9. 1. 2013, 14:31:55 · Upravil/a: Jaroslav Šour
Tori:
A jak to mám upravit? Stále mi to nefunguje Problém je, že ono to sice fotku do prifilu nahraje, ale pokud se odhlásím a znovu přihlásím tak už v profilu tu fotku nemám. Čím by to mohlo bejt. Bude to tím že to ukládá bez té tečky? |
||
Tori Profil |
#8 · Zasláno: 10. 1. 2013, 07:45:05
Jaroslav Šour:
Tím jsem chtěla naznačit, že u velké fotky se ta tečka přidává (a zvýraznila jsem kde), kdežto u náhledu už ne. Tj. že ji tam máte dopsat: ř.42: $new_file_name = $is_regist . '.' . (($photo_sizes[2] == 1)? "gif": ($photo_sizes[2] == 2) ? "jpg":"png" ); $new_file_name = $is_regist. (($photo_sizes[2] == 1)? ".gif": ($photo_sizes[2] == 2) ? ".jpg": ".png" ); |
||
Časová prodleva: 11 let
|
0