<commit_before>@extends('folio::admin.layout')

@php
	$site_title = 'Upload · '.config('folio.title');
	$remove_wrap = true;
@endphp

@section('title', 'Existing Images')

@section('content')

	<style>
	.o-image-upload__delete {
		cursor: pointer;
	}
	</style>

	<div class="admin-form o-wrap o-wrap--size-550">
	
		<p>
			<a href="/{{ Folio::adminPath() }}upload">↑ Upload File</a>
		</p>

	</div>

	<div class="o-wrap o-wrap--size-1000">

        @php
            $uploaderPublicFolder = config('folio.uploader.public-folder');
            $uploaderDisk = config('folio.uploader.disk');
            $uploaderUploadsFolder = config('folio.uploader.uploads-folder');
            $uploaderAllowedFileTypes = config('folio.uploader.allowed-file-types');

            $filenames = Storage::disk($uploaderDisk)->files($uploaderUploadsFolder);
            $videos = [];
            $images = [];
        @endphp

        @foreach($filenames as $filename)
            @php
                $basename = basename($filename);
                // Omit dot files
                if (substr($basename, 0, 1) == ".") {
                    continue;
                }
                // Determine if it's a video or an image
                $extension = explode('.', $basename);
                $extension = $extension[count($extension) - 1];
                
                $isVideo = in_array($extension, ['mp4', 'mov', 'webm']);
                if ($isVideo) {
                    array_push($videos, $filename);
                    continue;
                }
                array_push($images, $filename);
            @endphp
        @endforeach

        @if(count($images))

            <div class="admin-form grid">

                <div class="grid__item one-whole u-mar-b-3x u-mar-t-3x u-font-size--g">
                    <strong>Images</strong>
                </div>        

                @foreach($images as $filename)
                    @php
                        $basename = basename($filename);
                        
                        // Construct file path
                        $filePath = $uploaderPublicFolder.'/'.$basename;

                        // Veil
                        $veil = Folio::asset('images/veil.gif');

                        // Construct image path
                        $imageHighRes = $filePath;
                        if (config('folio.imgix')) {
                            $veil = imgix($veil);
                            $imageHighRes = imgix($filePath);
                            $image = imgix($filePath, ['w' => 250, 'q' => 60]);
                        } else {
                            $image = $filePath;
                        }
                    @endphp<commit_msg>Auto compress upload thumbnails.<commit_after>@extends('folio::admin.layout')

@php
	$site_title = 'Upload · '.config('folio.title');
	$remove_wrap = true;
@endphp

@section('title', 'Existing Images')

@section('content')

	<style>
	.o-image-upload__delete {
		cursor: pointer;
	}
	</style>

	<div class="admin-form o-wrap o-wrap--size-550">
	
		<p>
			<a href="/{{ Folio::adminPath() }}upload">↑ Upload File</a>
		</p>

	</div>

	<div class="o-wrap o-wrap--size-1000">

        @php
            $uploaderPublicFolder = config('folio.uploader.public-folder');
            $uploaderDisk = config('folio.uploader.disk');
            $uploaderUploadsFolder = config('folio.uploader.uploads-folder');
            $uploaderAllowedFileTypes = config('folio.uploader.allowed-file-types');

            $filenames = Storage::disk($uploaderDisk)->files($uploaderUploadsFolder);
            $videos = [];
            $images = [];
        @endphp

        @foreach($filenames as $filename)
            @php
                $basename = basename($filename);
                // Omit dot files
                if (substr($basename, 0, 1) == ".") {
                    continue;
                }
                // Determine if it's a video or an image
                $extension = explode('.', $basename);
                $extension = $extension[count($extension) - 1];
                
                $isVideo = in_array($extension, ['mp4', 'mov', 'webm']);
                if ($isVideo) {
                    array_push($videos, $filename);
                    continue;
                }
                array_push($images, $filename);
            @endphp
        @endforeach

        @if(count($images))

            <div class="admin-form grid">

                <div class="grid__item one-whole u-mar-b-3x u-mar-t-3x u-font-size--g">
                    <strong>Images</strong>
                </div>        

                @foreach($images as $filename)
                    @php
                        $basename = basename($filename);
                        
                        // Construct file path
                        $filePath = $uploaderPublicFolder.'/'.$basename;

                        // Veil
                        $veil = Folio::asset('images/veil.gif');

                        // Construct image path
                        $imageHighRes = $filePath;
                        if (config('folio.imgix')) {
                            $veil = imgix($veil);
                            $imageHighRes = imgix($filePath);
                            $image = imgix($filePath, ['w' => 225, 'q' => 50, 'auto' => 'format,compress']);
                        } else {
                            $image = $filePath;
                        }
                    @endphp
{'fraction_non_alphanumeric': 0.13889894965592176, 'fraction_numerical': 0.0065193770373053244, 'mean_word_length': 1.3147527242246437, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4322157', 'n_tokens_mistral': 1583, 'n_tokens_neox': 1452, 'n_words': 278}