Asked  7 Months ago    Answers:  5   Viewed   46 times

I've been looking into using html 5 <input type="file" accept="image/*" capture="camera"> to take a picture from my webapp and upload the image to the database using php - this is now working correctly.

However, the only way I can seem to find to display the "take picture" option is by a text field that has a button in it called "choose file"

Is there a way to be able to click on the existing image to open up the take picture options, then display the new image instead of the existing picture after the picture has been taken/file selected by the user? They should then click on the "upload" button if they are happy to save the image.

See JS fiddle here, hopefully this makes some sense!



You have to use Javascript Filereader for this. (Introduction into filereader-api:

Once the user have choose a image you can read the file-path of the chosen image and place it into your html.


<form id="form1" runat="server">
    <input type='file' id="imgInp" />
    <img id="blah" src="#" alt="your image" />


function readURL(input) {
    if (input.files && input.files[0]) {
        var reader = new FileReader();

        reader.onload = function (e) {


Wednesday, March 31, 2021
answered 7 Months ago

Based on your screenshot of Settings (Preferences on Mac) | Editor | Language Injections.

Please delete 3rd language injection rule from the bottom (the one for "div" -- that has "IDE" in Scope column).

That rule injects HTML into div tag which tells IDE to treat all other code (even PHP) inside such tag as HTML/plain text.

Thursday, August 5, 2021
answered 3 Months ago

i think is because you are downloading the image from web and you need to do these in ASYNC see painless thrething download image and after that refresh just the imageviews.

Friday, August 13, 2021
answered 3 Months ago

A recent change in PHPMailer allows Debugoutput to be a closure, so you can make it do whatever you like, for example to collect all the debug output and emit it later:

$debug = '';
$mail->Debugoutput = function($str, $level) {
    $GLOBALS['debug'] .= "$level: $strn";
echo $debug;
Monday, August 16, 2021
answered 2 Months ago

A slight simplification of @rikAtee's answer / addition of detecting the page count automatically by counting the length of the sequence:

def convert_pdf_to_png(blob):
    pdf = Image(blob=blob)

    pages = len(pdf.sequence)

    image = Image(
        height=pdf.height * pages

    for i in xrange(pages):
            top=pdf.height * i,

    return image.make_blob('png')

I haven't noticed any memory link issues, although my PDFs only tend to be 2 or 3 pages.

Sunday, October 3, 2021
answered 3 Weeks ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :