Coder Social home page Coder Social logo

lisa-fehr / recreate-gallery-script Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.54 MB

Convert an old gallery model into a Laravel project. A series of mobbing growth sessions.

PHP 91.71% JavaScript 0.21% CSS 0.19% Shell 0.49% Blade 0.44% Vue 6.95%
hacktoberfest laravel vue tailwind

recreate-gallery-script's Introduction

recreate-gallery-script

Convert an old gallery model into a Laravel project.

Repo contains the new and improved version in /gallery

Repo also contains:

  • the broken Wordpress plugin to create the thumbnails: /archi_gallery
  • the scary Model that was used to display the gallery in a Wordpress page: archi_gallery.php
  • the thumbnail generator in archi_thumb.php

Alt text

recreate-gallery-script's People

Contributors

lisa-fehr avatar

Watchers

 avatar

recreate-gallery-script's Issues

Add a command to store the full path to the thumbnail and image in the gallery

The directory is stored on the uber_tags table. The location of the images would occasionally change and was not stored per entry in the gallery.

  • Add a new field to the uber_gallery table called name and copy image to it.
  • Add a dev command to refresh the thumb and image fields with the result of the methods getThumbnailAttribute and getImageAttribute.
    • ideally add a flag to the gallery table if it stored a missing image and add an option to the command to retry those items

Log missing thumbnails/images

The thumbnail or image association could be a 404 (checked on UberGallery@getImageAttribute & UberGallery@getThumbnailAttribute). Need to log if those methods return null.

Message:
{url-to-image-or-thumbnail} missing gallery image|thumbnail in {tag/filter}

Recreate the navigation from the existing tags table

Examples are based on the seeder provided.

  • Create a navigation vue or blade component
  • The landing page should show all and photos. All is the page you are currently on. It contains all images to the right of it (total may currently be broken).
    • url was /portfolio
    • Bonus: should see all thumbnails
  • When photos is clicked it will show all and California
    • url was /photos (retaining SEO later)
    • Show back text that returns to the landing page (IE: back to portfolio)
    • Bonus: show all thumbnails with the parent photos
  • When California is clicked it should show 2014.
    • url was /California (retaining SEO later)
    • Show back text that returns to photos (IE: back to photos)
    • Bonus: show all thumbnails with the parent California (contains several years)
  • When 2014 is clicked it should show all.
    • url was /California/2014 (retaining SEO later)
    • Show back text that returns to California (IE: back to California)
    • Bonus: show only thumbnails for California2014

Original landing page:
Screen Shot 2021-10-04 at 3 34 18 PM

Original photos page:
Screen Shot 2021-10-04 at 3 34 45 PM

Fix the Model Relationship

The original database isn't Laravel friendly.

I never ended up tagging an image with more than one tag.
uber_tags should have a direct relationship to uber_gallery. No more uber_tag_assoc silliness.

  • Make a migration to add tag_id to the uber_gallery table
  • Make a migration to move the tag associations from the uber_tag_assoc table
  • Fix the tag relationship on App\Models\UberGallery by using the tag_id column
  • Remove App\Models\UberTagAssoc
  • Add a migration to remove the uber_tag_assoc table

Screen Shot 2021-10-04 at 4 40 04 PM
Screen Shot 2021-10-04 at 4 52 33 PM

Add a Laravel command to update the total images

There is a count stored on App\Models\UberTags

The below should be possible using the scopeAllChildren on UberTags. Write a test for the scope.

Parents contain the total images of all children tags.

all is the total of children in photos, California

photos and California has children=true and doesn't tend to have any images of its own.

Based on this example: photos contains Berlin, California, FanExpo. Inside those folders are child tags for up to three years. (IE: 2005, 2009, 2014)

Screen Shot 2021-10-04 at 3 34 45 PM

Current seeding doesn't give a lot of examples:
Screen Shot 2021-10-04 at 4 39 44 PM
Screen Shot 2021-10-04 at 4 40 04 PM

Add pagination

Add pagination once the gallery display is merged in

  • 24 images per page (in the end)
  • Current page indicator
  • Disable forward/back when unavailable
  • Ability to navigate to further pages

Example of previous navigation:
Screen Shot 2021-10-04 at 3 30 55 PM

Note: this won't always be all images, they will be split into categories.

Have a command to regenerate thumbnails from a tag (or all)

Can be determined with the App\Models\UberGallery tag relationship in the /gallery folder.

  • it should prompt for tag (IE: California2014) and if left empty it should re-do all
    • bonus if you can get parent tags to also work (IE: photos, California)
  • it should prompt for thumbnail width and height
  • it should be similar to App\Console\Commands\GenerateImages

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.