vendredi 27 février 2015

how to add multiple images into same field of database table using laravel 4


Vote count:

0




Iam new in laravel..Iam trying to insert image into DB table. i have 2 tables 1.album(id,albumname,galimg_id) and 2.galleries(id,galname,galimg,album_id). 1st im upload 1 images into database with save image into same folder(home). and some time later im upload another image into database with save image into same folder(home). DB table like this album-table id albumname galimg_id

1 home home/a6.jpg


galleries-table id galname galimg album_id 1 play home/a1.jpg 1 2 a6 home/a6.jpg 1 but the problem is ..the 2nd image is not save into album DB table, but its save into galleries table.and also save into home folder. my controller.php code is here



$id=Input::get('id');
$f1=Input::get('f1');
$f2=Input::get('f2');
$file=Input::file('galimg');
$filename=$file->getClientOriginalName(); //save img name into database
$file->move('img/Albums/'.$f1,$filename); //move image into temporary folder img/gallery
if(ForumGallery::where('album_id', $f2)->count() < $max_photo)
{
ForumGallery::create([
'galname'=>Input::get('galname'),
'galimg'=>$f1.'/'.$filename,
'album_id'=>Input::get('f2'),
]);
}else
{
return Redirect::route('viewalbum')
->with('fail',' Only 12 images');
}
$album = Input::get('f1');
$albums = ForumAlbum::where('albumname', $album)->first();
$albums->galimg_id =$f1.'/'.$filename;
$albums->save();


how to add multiple images into same field of database table using laravel 4 i think "implode" is working but ,i dont know how to use?



asked 12 secs ago







how to add multiple images into same field of database table using laravel 4

Aucun commentaire:

Enregistrer un commentaire