0

I'm pretty sure php is what I need to use here. Very new to it so I appreciate any direction or answers/resources offered.

I have the below Steps 1 and 2 working with html/css/js

Step 1 Users will paste a url in the input box and click submit. That creates a div above the input with an img src equal to the user input value.

Step 2 Users will paste a url in the input box and click submit. That creates a div above the input with an img src equal to a different user input value.

Step 3 User clicks "submit to gallery" button which I think would use php to submit Step 1 and 2 img src into two separate divs within a container div. That container would then be sent to the gallery and be able to be linked to directly by a url address.

Below is the html and js I'm using.


Here is a placeholder gif until user replaces using load button

<div id="gif-btn">
    <img class="img-responsive" src="http://i.imgur.com/TtYVO.gif">
</div>

User Inputs gif url

<input type="url" class="form-control" placeholder="Gif link here..." id="txt"/>

Then clicks load button

<a class="btn btn-danger" id="gif-btn" onclick="getGif();">Load</a>

Here's the js

function getGif(){

    var url=document.getElementById('txt').value;
    var div=document.createElement('div');
    var img=document.createElement('img');

    img.className="img-responsive";

    img.src=url;

    div.appendChild(img);

    document.getElementById('gif-btn').innerHTML = ""; // <-- Clears the gif-btn div
    document.getElementById('gif-btn').appendChild(div);

    return false;
}
dMaller
  • 113
  • 1
  • 12
  • Have you researched cURL? You can grab an image via cURL and write to a desired directory. This is desired behavior since the user is requesting an image via a URL link. http://stackoverflow.com/questions/10890617/grabbing-image-with-curl-php – justinpage Jan 08 '14 at 01:39
  • Take a look at this question: http://stackoverflow.com/questions/934012/get-image-data-in-javascript – Halcyon Jan 08 '14 at 02:04

0 Answers0