how to display the image in dropzone from database in codeigniter - codeigniter

i want to display the image from the database in dropzone.
here is my view page :
<div class="col-md-6"> <b>Challenge Banner</b>
<form class="dropzone dz-clickable" id="#" action="<?php echo base_url(''); ?>Challenge/file_upload" enctype="" method="post">
<div class="dz-message text-center" style='height:80px;'>
<div class="drag-icon-cph"> <i class="material-icons" style='font-size:36px;'>touch_app</i>
</div>
<h6>Drop files here or click to upload.</h6>
</div>
</form>
</div>
i want to display image from data base.. how i can upload the image?

Related

Livewire - File Uploads - Temporary Preview URL's Error - Serialization of 'Livewire\TemporaryUploadedFile' is not allowed

I am creating multiple steps form with livewire. In the third step, I am uploading the image via livewire and also previewing the image on the image selected.
After previewing the image, when I move to the first or second step it returns the error - [Serialization of 'Livewire\TemporaryUploadedFile' is not allowed]
Please help me, with how I can solve this issue.
<div class="form-row pl-2 pr-2 reward-engagement mt-3">
<div class="col-md-9 mb-3">
<label for="validationDefault01"><small>UPLOAD IMAGE</small></label>
<div class="input-group input-group-merge">
<input type="file" class="form-control form-control-sm " id="amount5" wire:model="photo" />
</div>
</div>
<div class="col-md-3 mt-4 mb-2 pt-1">
<button type="button" class="btn btn-sm btn-success btn-icon" wire:click="mission_description"> <span>Continue</span> </button>
</div>
</div>
<div wire:loading wire:target="photo">Uploading...</div>
#if($photo)
<img src="{{ $isUploaded ? $photo->temporaryUrl() : asset('public/'.$photo) }}" width="150" height="150">
#endif
ScreenShot:
Front View Screenshot
It is a temp file and Livewire can't serialize it on subsequent requests. You have to store the file
https://laravel-livewire.com/screencasts/s5-intro
Do you by any chance have multiple components for each step?

How to solve after upload the image missing in html

I am doing an image upload. The image successfully uploads but when press the button the image will missing.
This is my interface for image upload
when I select the image
the default image will change to the image I select
ut after I press the upload button to the backend it works but the selected image will become back the default one. Does anyone know how to solve it? Thanks in advance
Here is my code:
<form method="POST" action="url" enctype="multipart/form-data" id="upload">
#csrf
<div class="d-flex mb-2 ms-1 justify-content-md-center">
<img src="{{ asset('assets/images/placeholder.png') }}"/>
</div>
<label class="btn me-75 mb-0" for="picture">
<span class="d-none d-sm-block">Upload</span>
<input class="form-control" type="file" name="image" id="change" accept="image/*" hidden required/>
</label>
</form>

How to use laravel shweshi/OpenGraph

Here how to use it according to its GitHub
I already install the package:
Use Opengraph
$data = OpenGraph::fetch("http://www.addemyplus.com/blogs/my-faith-for-your-love");
that may return an array:
{"type":"website","title":"My Faith For Your Love","description":"","image":"http:\/\/www.addemyplus.com\/images\/frontend_images\/blogs\/medium\/57670.jpg"}
My problem is how can I use it on my blade that whenever I type a link in the form it will fetch the Og data of that site.
and show below the image and description
I have this code on form:
<form action="{{route('store_post_path')}}" method="POST">
{{csrf_field()}}
<div class="form-group">
<label class="sr-only" for="title">title</label>
<input type="text" class="form-control" name="title" placeholder="Your Post Title or Question">
</div>
<div class="form-group">
<label class="sr-only" for="post">post</label>
<textarea class="form-control" name="post_content" id="post_content" rows="3" placeholder="Briefly explain your question or Your Post Content"></textarea>
</div>
<div class="tab-pane fade" id="images" role="tabpanel" aria-labelledby="images-tab">
<div class="form-group">
<div class="custom-file">
</div>
</div>
<div class="py-4"></div>
</div>
<div class="btn-toolbar justify-content-between">
<div class="btn-group">
<button type="Submit" class="btn btn-primary">Share your Post</button>
</div>
</div>
</form>
How can I use the code to fetch the Og property of the link? I want to view the image and title of the link below before submitting my post.. Please show some tutorial sites for this.
Get the link from the form in post content. You can do it using regex.
function getUrl($string)
{
$regex = '/https?\:\/\/[^\" ]+/i';
preg_match_all($regex, $string, $match);
return ($match);
}
$url = getUrl($string)
If there are any links in post content you will get array of links.
Use OpenGraph::fetch($url) to fetch the OG data of the url. That you can show in the view.

New to Laravel, trying to integrate Square Payment Form

I've been following the instructions on Square's website.
I've got all the code I need plugged into my application as shown on square, but the asset('js/square.js') call didn't find the file for some reason. So, I just added the script to the end of the resources/js/app.js file, doesn't seem to have any errors but the form doesn't look right..
<form id="nonce-form" novalidate action="PATH/TO/PAYMENT/PROCESSING/PAGE" method="post">
#csrf
<fieldset>
<span class="label">Card Number</span>
<div id="sq-card-number"></div>
<div class="third">
<span class="label">Expiration</span>
<div id="sq-expiration-date"></div>
</div>
<div class="third">
<span class="label">CVV</span>
<div id="sq-cvv"></div>
</div>
<div class="third">
<span class="label">Postal</span>
<div id="sq-postal-code"></div>
</div>
</fieldset>
<button id="sq-creditcard" class="button-credit-card" onclick="requestCardNonce(event)">Pay $1.00</button>
<div id="error"></div>
<!--
After a nonce is generated it will be assigned to this hidden input field.
-->
<input type="hidden" id="card-nonce" name="nonce">
</form>

Wget post data with text box that has randomly generated value?

I'm trying to use Wget to log in to my router and make a complete mirror of all the pages. The problem is, the router login page does not use the traditional "user" & "pass" ID for the text fields. It has a 'Password' and 'VmWpsPin' field. The ID for the 'Password' field is randomly generated every time the page is loaded/refreshed/requested. Below is the source code of the relevant part of the router page:
<body lang="en" class="superhubGUI" onload="javascript:Init()">
<div class="globalHeader">
<div id="nav">
<div id="logo">
<h1 id="header">Super Hub</h1>
</div>
<div id="buttons">Router Status
</div>
</div>
</div>
<div id="content">
<div id="container">
<div id="main">
<div class="panel noTitle" style="*padding:38px 30px 0px 30px">
<div id="login" class="inner">
<div class="inner-section">
<h2>Welcome to your Virgin Media Super Hub 2ac</h2>
<div id="signInForm">
<form action="/cgi-bin/VmLoginCgi" method="POST" name="signIn1" id="signIn">
<h2 id="loginTitle">Sign in to view and change your settings</h2>
<div class="field formField noHint username clearfix">
<label for="username"></label>
</div>
<div style="position:relative;top:-20px;" class="field formField noHint password clearfix">
<label for="password">Settings Password</label>
<input type="password" autocomplete="off" value="" maxlength="15" class="name required onefiftyPX inactive" name="KsCAqiihZb" id="password" onkeypress="handleKeyPress(event)" />
<div style="position:relative;left:-10px;" class="tooltip">
<img style="position:absolute; top:10px;" src="../images/toolTipButton.png"><span>Password can be found on the base of your Super Hub</span>
</div>
</div>
<div style="position:relative;top:-25px;" class="field formField noHint password clearfix">
<label for="password">WPS PIN</label>
<input type="text" autocomplete="off" value="" maxlength="15" class="name required onefiftyPX inactive" name="VmWpsPin" id="WpsPin" onkeypress="handleKeyPress(event)" />
<div style="position:relative;left:-10px;" class="tooltip">
<img style="position:absolute; top:10px;" src="../images/toolTipButton.png"><span>WPS PIN can be found on the base of your Super Hub</span>
</div>
</div>
<div>
Sign In
</div>
</form>
<p>
<span style="font-weight:bold;">Don't know your password?</span>
<br/>You'll find your default password on the bottom of your Super Hub.
</p>
</div>
</div>
</div><span class="pFoot"> </span>
</div>
</div>
My question is, how can I use Wget to login to the router when the ID changes at every request, is there somehow a way to request the page, parse the value out and then submit the form using something like --keep-session?
Or is there an alternative solution outside of Wget to automate the process? Any help is much appreciated.

Resources