Completed

Fix Delete Image/Video Script PHP

I have a PHP script with some javascript...

It displays a list of images that also has videos with the same names... If I select an image, and click go, the script will delete the image and the video file associated with the image.

I have made a change the old directory showed ... "/videos/Needs_Reviewed/*.*" as the file location. I changed it to "/videos/Needs_Reviewed/*/*.*" Because I added a folder between Needs_Reviewed and the Videos/images... the * folder's name changes...

Now it will not delete the image and the video when selected.... This is a simple one page PHP script that has already been developed, this should be a quick change... Here is the code...

<html><head><title>This is a simple PHP script to delete select images.</title>

<script src="[login to view URL]"></script>

<style type="text/css">

.item {

background-color: green;

}

input:checked+.item {

background-color: red;

}

</style>

</head><body bgcolor="red" text="black">

<?php

if (isset($_POST['image_list'])) {

foreach ($_POST['image_list'] as $imagename) {

// delete image by id.

if (file_exists($imagename)) {

unlink($imagename);

/* delete video */

$videoname = substr($imagename, 0, strrpos($imagename, '.'));

unlink($videoname);

/* delete video */

}

}

}

?>

<script type="text/javascript">

function toggle(cb_id) {

var cb = [login to view URL](cb_id);

[login to view URL] = ![login to view URL];

}

</script>

<script type="text/javascript">

$(document).ready(function(){

$('#select_all').on('click',function(){

if([login to view URL]){

$('.checkbox').each(function(){

[login to view URL] = true;

});

}else{

$('.checkbox').each(function(){

[login to view URL] = false;

});

}

});

$('.checkbox').on('click',function(){

if($('.checkbox:checked').length == $('.checkbox').length){

$('#select_all').prop('checked',true);

}else{

$('#select_all').prop('checked',false);

}

});

});

</script>

<form action="<?PHP $SERVER['PHPSELF'];?>" method="POST"><p>Please select multiple images you want to remove. Please note that the selected images will be removed from server as well.</p><ul class="main"><li><input type="checkbox" id="select_all" /> Select all</li><ul>

<?php

$files = glob("videos/Needs_Reviewed/*/*.*");

for ($i=0; $i<count($files); $i++)

{

$image = $files[$i];

$supported_file = array(

'jpg',

);

$ext = strtolower(pathinfo($image, PATHINFO_EXTENSION));

if (in_array($ext, $supported_file)) {

echo '<li><input type="checkbox" class="checkbox" name="image_list[]" style="margin-right:10px;" id="'.$i.'" value="'.$image.'" /><div class="item">';

echo basename($image)."<br /><br />"; // show only image name if you want to show full path then use this code // echo $image."<br />";

echo '<img src="'.$image .'" style="max-height:600px; max-width: calc(85% - 20px); alt="Random image" onclick="toggle(\''.$i.'\')" /></div></li>'."<br/>";

} else {

continue;

}

}

?>

</ul></ul><input type="submit" name="submit" style="width:300px;height:60px;margin-left:20px;" value="Delete" /></form></body></html>

Skills: PHP, JavaScript, jQuery / Prototype, AJAX, HTML

See more: flash image rotator script php mysql, multiple image upload script php ajax, free manuel embed code add video script php, best flash video script php ffmpeg, facebook image tag script php, image watermarking script php, image adjustment script php, image url script php, image hosting script php, image arranger script php, image vote script php, capture image youtube video script php, video image upload script php

About the Employer:
( 63 reviews ) Ft Walton Beach, United States

Project ID: #31402605

Awarded to:

polonska

❤️Dear Client❤️ Hello, How are you? I've 8+ years of experience in php, javascript and I'm sure I can do this project. I've just read your job summary with all happiness and expected mind. Because I can give you satis More

$20 USD in 1 day
(0 Reviews)
0.0

9 freelancers are bidding on average $24 for this job

JhunsInfotech

Hi, This is Ajay I can do your website Fix Delete Image/Video Script PHP as per the above description given . Having more that 5 + year of experience In PHP Framework and WordPress Development I look forward to di More

$24 USD in 1 day
(73 Reviews)
6.2
tanveerk0956

will complete this task in less then 1 hour, ready to start right now. thanks................................................

$25 USD in 1 day
(161 Reviews)
6.0
(41 Reviews)
5.8
csuciu38

Hi! I have all the abilities in need to solve this kind of task. I am available and ready to start working. Best Regards, CristinaS

$25 USD in 1 day
(6 Reviews)
4.5
technicalfoodie

Dear Sir, I can do this job in couple o hours, its pretty easy job for me, I have done so much work and I am expert in this. Hope for your reply next. Regards, M. singh

$20 USD in 1 day
(7 Reviews)
3.8
stanicadevelope6

❤️Warm greeting❤️ I read your job posting. This is no problem for me as I am a php/javascript expert. I can start work right now. This work can be done in a quick time because I am a full-time developer. Let's discuss More

$30 USD in 1 day
(7 Reviews)
3.5
parsantsharma

Hi     how are you? i have 5+year experience in wordpress, shopify,ecommerce and woocomerce Shopify links [login to view URL]  [login to view URL]  [login to view URL] please check these wordpress links: [login to view URL] https More

$30 USD in 1 day
(0 Reviews)
0.0
nguyen529

Hello, how are you? checked you requirement in detail. i can do it and will give good result to you. thanks

$20 USD in 1 day
(0 Reviews)
0.0