Coder Social home page Coder Social logo

puzzle's Introduction

Puzzle-With-File-Uploads

Using the attached sliding puzzle game (or your own if you prefer) modify the code so it works in the following way:

When the page is loaded initially, the default image should be used for the puzzle This image and all its tiles are stored in the "images" directory Three new buttons are now available in the "control panel" area (provided) "Choose File" which allows you to choose an image for uploading "Upload" which submits the uploaded file When this button is pressed your game should behave in the following way If any errors occur, you should display a JavaScript alert and reset the game to the default image Possible errors are:

  • File is not an image
  • allow jpeg, png, and gif images
  • File is not at least 612 pixels on one of the sides
  • File is too large (max size should be 1.5MB)
  • No file was uploaded All files in the "uploads" directory except those starting with a dot should be deleted use scanDir() and unlink() for this. If all is good with the upload, it should be scaled down to be 612 pixels on the longest side The final scaled image should be modified slightly so that both the height and width are multiples of 3 612 is already a multiple of three The other dimension will need to be reduced by at most two pixels This scaled image should be saved as "guideImage.jpg" in the "uploads" folder After scaling, you should slice the guide image into nine equal-sized tiles and saved as "tile0.jpg" - "tile 8.jpg" For simplicity, save all slices as jpegs You will create a blank image by doing the following:
  • create a new image resource in php of the proper size
  • Sample the center pixel in the guide image
  • use imagecolorat() for this
  • extract the r, g, b values for that color
  • read the php manual to find out how to extract the rgb values
  • Invert the color extracted and use the inverted color for the blank
  • fill the new image resource with the new color
  • use imagefill() for this
  • Save the image as "blank.jpg" in the "uploads" folder
  • "Reset to default puzzle image" When this button is pressed, the page is reloaded using the default image for the puzzle

Teams

  • Johnny/Peyton/Naihrobi/Michael
  • Jon/JP/Eli/Leo

Include a document describing your contribution to the project

Contributions:

Johnny:

Naihrobi:

Michael:

Peyton:

puzzle's People

Contributors

johnnyaraya avatar martygilbert avatar

Watchers

 avatar

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.