2016-11-19 16 views
2

私はdropzoneを使ってLaravelに画像をアップロードしています。サムネイルの下部にファイル名を表示

サムネイルの下部にイメージ名を表示する方法はありますか?

サムネイルにホバリングしたときに画像名が表示されますが、サムネイルの上にファイル名を表示せずにサムネイルの下にファイル名を表示することをお勧めします。

コードは以下のとおりです。

私のアップロードページに私のdropzone js。

Dropzone.options.imageUpload = { 
    paramName: "image", // The name that will be used to transfer the file 
    maxFilesize: 30, // MB 
    uploadMultiple: true, 
    clickable: true, 
    maxThumbnailFilesize: 30, 
    parallelUploads: 1, 
    maxFiles: 10, 
    dictMaxFilesExceeded: "This image is exceeded the limit upload", 
    init: function() { 
    this.on("queuecomplete", function(file) { $("#buttons").show(); }); 
    }, 
    accept: function(file, done) { 
    if (file.name == "justinbieber.jpg") { 
     done("Naha, you don't."); 
    } 
    else { done(); } 
    } 
}; 

私のアップロードコントローラ

$User = Auth::user()->id; 
    $category = Category::active()->first(); 
    $sizeHeight = Size::orderBy('height', 'ASC')->where('status', 0)->first(); 
    $sizeWidth = Size::orderBy('width', 'ASC')->where('status', 0)->first(); 
    $files = $request->file('image'); 

    if(!empty($files)): 
     $urls = array(); 
     foreach($files as $val => $file): 
      $now = Carbon::now(); 
      $time = str_replace(':', '-', $now); 
      //$number = $val + 1; 

      echo $sizeHeight; 
      echo $sizeWidth; 
      $filename = $file->getClientOriginalName(); 
      //get image size 
      $filepath = $file->getRealPath(); 
      list($width, $height) = getimagesize($filepath); 
      //if wrong orientation then 

      if($width >= $sizeWidth->width || $height >= $sizeHeight->height) 
      { 
       // Ryan 22 October 2016 (Saturday) move save photo to top 
       $photo = new photo; 
       $photo->user_id = $User; 
       $photo->photoName = $time . $filename; 
       $photo->category_id = $category->id; 
       $photo->subcategory_id = "1"; 
       $photo->name = null; 
       $photo->keyword = null; 
       $photo->status = "2"; 
       $photo->save(); 

      } 
    endif; 

私はサムネイルに

enter image description here

をホバリングしていると私はそれがホバリングせずにこのような何かになりたいと思ったとき、これは私の現在の結果です。

enter image description here

助けてください。

+0

いくつかのコードを追加してください... –

+0

あなたのコードを共有してください...私は私が私の絵にテキストを追加したいいけない私のコード –

+0

@MinalChauhan。私はちょうど私のdropzoneのサムネイルの一番下に私のファイル名を表示したい –

答えて

0

画像にテキストを追加する場合は、パッケージをLaravelに使用できます。 text()メソッドがそれを助けます。

任意のx、yベースポイント位置に現在のイメージにテキスト文字列を書き込みます。 4番目のパラメータとして、コールバックを介してfont-size、font-file、およびalignmentのような詳細を定義することができます。

ファイルを編集せずに画像の上にテキストを表示したい場合は、use CSSを使用できます。

+0

を更新している私のコード –

関連する問題