![]() |
Should i save filename with extension to database or without - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Should i save filename with extension to database or without (/showthread.php?tid=38032) |
Should i save filename with extension to database or without - El Forum - 01-28-2011 [eluser]pisces77[/eluser] Hi thanks in advance, i'm building image gallery i'm not saving file extension to database and in view i was just using filename than concatenate extension .jpg but now problem is if user upload .png than i run into problem... also thumbnail generated by image_lib attach word _thumb to original file name here again i have to code..what i have to code ?..what if it save file with original file name but in different folder so i just change the path and it would work.... some one suggested me to check if file exist than get extension of that file i don't know i did't like that option.. currently 1 - my controller simply upload files i'm using uploadify...and model insert record in database without file extension just filename. 2 - controller get all photos from model and i pass that object to view and loop through all files... sorry for the long explanation i'm newbie may be some one can point there you are doing wrong...do this way... CONTROLLER Code: function uploadify() MODAL add photo Code: public function add_photos($photo_name){ Code: public function index(){ Code: <?php i appreciate reading my long boring problem thank you so much for the help in advance...i want to learn how modal should be used some one suggest me don't use uri segment in modal control it through controller...etc Should i save filename with extension to database or without - El Forum - 01-28-2011 [eluser]SPeed_FANat1c[/eluser] Quote:i’m building image gallery i’m not saving file extension to database and in view i was just using filename than concatenate extension .jpg but now problem is if user upload .png than i run into problem… I didn't understand, why you don't want to save file name with extention to avoid problems? Should i save filename with extension to database or without - El Forum - 01-28-2011 [eluser]pisces77[/eluser] Thanks for the reply ...so i can concatenate string for thumb like original file name myfile.".jpg" than "small_thumb".myfile."_thumb".jpg for thumb folder file name..how i can stop image_lib to stop adding _thumb to file name.. if i save myfile.jpg than for thumb i have to use myfile_thumb.jpg so have to code it the way it should insert at the end of file name _thumb....if it is in beginning it will be easy ![]() Should i save filename with extension to database or without - El Forum - 01-28-2011 [eluser]Gerep[/eluser] create a image copy: Code: $config['new_image'] = '/path/to/new_image.jpg'; Should i save filename with extension to database or without - El Forum - 01-28-2011 [eluser]pisces77[/eluser] [quote author="Gerep" date="1296250580"]create a image copy: Code: $config['new_image'] = '/path/to/new_image.jpg'; Thanks but i'm already using this it create thumbnail original_file_name + _thumb how i can remove _thumb ? Should i save filename with extension to database or without - El Forum - 01-28-2011 [eluser]pisces77[/eluser] [quote author="pisces77" date="1296256573"][quote author="Gerep" date="1296250580"]create a image copy: Code: $config['new_image'] = '/path/to/new_image.jpg'; Thanks but i'm already using this it create thumbnail original_file_name + _thumb how i can remove _thumb ?[/quote] i guess i got it i'm not assigning any new name its going empty so that's why it using default_thumb name....i will pass the same original_file_name varaible her....i guess it will work thanks..did't try it yet but i hope it will work.. Should i save filename with extension to database or without - El Forum - 01-28-2011 [eluser]Gerep[/eluser] If so, tell us ok? Maybe it will help someone else ![]() |