Delete Image From Folder
I have some php scripts to upload images and delete it. But if I delete the image I only delete the image's data in the database, and the image still remains in the folder. My question is, how can I remove the image from the image folder?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Delete Folder FTP
I am trying to delete a folder and all of its contents (folders, files) through ftp. I am trying to modify a script for deleting it locally. I don't get any errors with this, but nothing happens. Can someone point me in the right direction? Code:
How To Delete An Undeletable Folder!
I run PHP5 and was testing a script to allow users sampling a demo script But to keep security high asides the usuals I create a new folder and a new set of scripts per each required demo with a folder extension created by a rand function. So first the folder is created and a set of tpl are copied in the new folder and written on. To make a story short: While testing on the production server I found some bugs and fixed them but the first trial attempt created a folder with a set of files that weight exactly as the tpl copied from and do have a correct PHP extension but refuses to be deleted or renamed or schmod etc... via FTP Now that I am bugless I can indeed do whatever with then newly created folders and files but still cannot delete my first test. When I try to del it it goes away but if I refresh it’s back there!
Delete Ftp-folder Created Via Php Installation?
how do I delete a folder at my ftp-server, that was automatically created through a installation script? I dont have the permission to delete that folder :-( I have already found the following script, but I dont know where exactly do I need to execute it: --------------------------------------------------- <?php function delete($file) { chmod($file,0777); if (is_dir($file)) { $handle = opendir($file); while($filename = readdir($handle)) { if ($filename != "." && $filename != "..") { delete($file."/".$filename); } } closedir($handle); rmdir($file); } else { unlink($file); } } delete("folderrname"); ------------------------------------------------- ....whereas foldername at the end is the folder to be deleted. ?>
Delete Image
I have a folder on the server which contains images. I like to delete the images which only thier name start with "wc_106" the file name might look like ( wc_106_xxxxxx.jpg , wc_106_yyyyy.jpg , wv_dddd.jpg ), but I only want to delete the ones having a prefix "wc_106".
Simple Image And Folder Script
I want to have a simple script to show if a folder exist a random picture and the number of images in that folder like this uploads/admin.php will be the file which shows this info the below would be folders that have images in them so the admin.php would need to detect folder names under uploads/ and then show an image from each one and give me the count of images in each one uploads/candie/ uploads/sara/ uploads/amy/
Uploaded Image Is Not Going To The Proper Folder
This is the first time I have worked with uploading files through and html form with php. I can not see why this is not working. I used this form once and it worked and then I started adding some other things to the file and of course it does not want to move the file properly anymore. I just can not see why it is not working anymore. Code:
Writing Image To Folder On Server
i've succesfuly created a thumbnail from an image that has be verified and copied to a folder on the server for later calling from a database. I'm having trouble saving the new thumbnail file that has been created. using move_uploaded_file($thumb, $thumbupload); does not work. is there a GD function for writing an image to a directory? the thumbnail as be created and just needs to be written now.
Quick Image Show From Folder
I have a folder which contains 300+ images (captured from a Webcam). I want to create a scritp which will show these images in quick succession (preferably without reloading the whole page). Like an old age animation (filcker book). How Can I do this ??
Created Two Versions Of Image In Folder
I was wonder if I could get some help on putting together a script that would loop through all the images in a folder and created two other images (a thumbnail and a largesize) for each image? Code:
Retrieve An Image In Folder From Info Out Of Database
i am having problems displaying an image once i have uploaded it. i upload it to a folder and store its name in a database. below is the code to display the image. I have figured out the the code is not grabbing the name from the database but i can not figure out why. can anyone help? //Retrieves data from MySQL $data = mysql_query("SELECT IMAGE_NAME FROM item") or die(mysql_error()); //Puts it into an array while($info = mysql_fetch_array( $data )) { //Outputs the image and other data Echo "<img src=http://www.abcxyz.com/pics/".$info['photo'] ."<br>"; }
Viewing Image From A CHMOD Blocked Folder
How can I show an Image that is inside a folder which I've blocked using CHMOD? The reason I've blocked the containing folder of the Image is so no one could enter the folder's URL and see ALL of the images in it. For Example: I have a file that is viewing the "Dog" photo from the Blocked Folder "Private_Images". In that case I cannot view the dog's file because the "Private_Images" folder is blocked, but if I will remove the blocking from the folder, then anyone could view all of my other photos.
Create A Link To Delete An Image?
I'm making a really simple cms, but having problem deleting images. I've managed to create a page to upload the images to a folder. I also have a page that shows all the images and file names. Now I'm trying to add a link to delete images, but I can't get it to work. First of all I don't know what to put in the href tag...? Someone said I should create a new page that deletes the image and then redirects you back to the page displaying the images...? Code:
How To Point The Path To IMAGE Folder For MYSQL PHP Database
in my website there are ftp-uploaded images (about 3000) in a folder called IMAGE. What I want to do is somehow get the image file names inserted in to my database so, I can see image file names in a pull down menu selection when I insert records through FORM on a php file. i use MYSQL PHP LINUX configuration.
Remove From $name (folder)/(folder)/[x]/ <-- If Exists To Just Get [x].
I'll be quite honest. I don't have the faintest idea how to do this, while I can do other php without a problem. Once I know how to go about it I'll be okay. It's two things I think? 1. see if there's a trailing slash and delete it. 2. Remove the preceding path to /x, the folders and slashes, and delete them. and then I have x. X by the way is the final folder in a website and this grabs it for me. <? $name = $REQUEST_URI; ?>
How Do I Get The Image Height Width When Generating Image From PHP (getimagesize Does Seem To Work)
Is it possible to obtain the width/ height of an image when that image is dyanically created using a PHP script and passing GET attributes. For example: <img src="images/showImage.php?image_id=5" /> My images are created from images stored on the server, their paths stored on in database table and retrieved using the GET image_id and PHP script (showImage.php). Because the images are different sizes I would like to be able to use a PHP function / class that can take an image path and generate the IMG width and height attributes. This would just tidy up the page when loading. So when I try to use PHP 'getimagesize' like so: $wh = getimagesize ($_SERVER['DOCUMENT_ROOT'] . "/images/showImage.php? image_id=5"); .... I get an error saying that the file or directory does not exist: Warning: getimagesize(/customersites/0/home/httpd/vhosts/ mydomain.co.uk/httpdocs/images/showImage.php?image_id=5): failed to open stream: No such file or directory in /customersites/0/home/httpd/ vhosts/mydomain.co.uk/httpdocs/classes/html.class.php on line 11 I thin it may be the GET atttribute that is throwing it. How would I go about doing this?
Determine Image Information On Image Stored In MySQL BLOB
I store images in my DB as BLOB. When I want to place them in an html table, I want to determine the width of the image in order to asign the correct width to the column inside table. For JPEGs this is working fine, this is my code: $image = @imagecreatefromstring($r["foto"]); return @imagesx($image); where $r["foto"] is the field selected from the db which contains the image. For GIFs however, its getting really on my nerves !! I know imagecreatefromstring is not supported in gd2 and I tried several thinks. None of them worked ! : - $temp = tmpfile(); list($width, $height, $type, $attr) = getimagesize($temp); echo $attr; gives me :Warning: getimagesize: Unable to open 'Resource id #6' for reading - $handle = fopen("/tmp/tmp.dat", "w+"); fwrite($handle, $r["foto"]); list($width, $height, $type, $attr) = getimagesize($handle); echo $attr; gives me : Warning: getimagesize: Unable to open 'Resource id #6' for reading - Doing this with imagecreatefromgif($temp); wont work either ! Can somebody help me out please? by telling me what I'm doing wrong or what I should do.
Script To Post A Placeholder Image If Image Is Not Found On Server
I'm creating a site with an archive of photo galleries, and on each gallery page i'm looking to have a sidebar that shows a cross-section of other galleries in groups of 10, via thumbnails... except that sometimes, the updated galleries won't actually be there yet, so i'd like to have a script that basically looks for "set053/001.jpg", and if that image hasn't been uploaded, then a placeholder image saying "coming soon" would be shown. Ugh, that's a horrible descrition. Here's the outline of it: -Say there are 52 photo sets (updates will be made regularly). -If you're on any gallery between 1 and 10, this "sidebar" will show thumbnails of the other galleries within that group of 10. -On a gallery between 11-20, you'll see the sidebar thumbnails for galleries 11-20... and so forth. -But on the most recent set of 10, in this instance galleries 51-60, the galleries 53 thru 60 haven't yet been uploaded, so having a static sidebar that shows "galleries 51-60" would yeild broken images for the thumbs for 53 - 60 right now. So hopefully that made more sense... basically, if PHP can find "set053/001.jpg" on the server, it shows it. If it can't, then have it show something like "images/comingsoon.jpg".
Writing A Blob Image Out To A File - Jpg Image Looks Weird?
I've got simple watermarking working. I write a Blob image out from my db to a temp file and then overlay the watermark image to create 1 whole image. The watermark is perfect, but the exported blob behind it looks all garbled - parts are visible but its not right! I've looked at the temp file thats created by the line "fwrite($t_img, $data);" and the image looks corrupt, but displaying this field using usual php methods the blob looks fine..... Here's the code :- @MYSQL_CONNECT("$server","$user","$password"); @mysql_select_db("$database"); $query = "SELECT image, mime_type, image_width, image_height FROM items WHERE ID='$id'"; $result = @MYSQL_QUERY($query); $data = @MYSQL_RESULT($result,0,"image"); $type = @MYSQL_RESULT($result,0,"mime_type"); $image_width = @MYSQL_RESULT($result,0,"image_width"); $image_height = @MYSQL_RESULT($result,0,"image_height"); // Write blob data out to temp image file to prep for Watermark // creating a temp image name $t_img_name = tempnam ("./temp", "timg"); $t_img = fopen($t_img_name, "w"); // $content is the blob field with the image. fwrite($t_img, $data); fclose($t_img); //-$size = getimagesize($t_img_name); //echo $size[0]." - ".$size[1]; $img = imagecreatefromjpeg($t_img_name); $watermarkImage = 'images/watermark2.png' $x = 165; $y = 130; imagesetbrush($img, imagecreatefrompng($watermarkImage)); imageline($img, $x, $y, $x, $y, IMG_COLOR_BRUSHED); imagejpeg($img); // End of watermark protection // don't forget to delete the temp file after all. //unlink($t_img_name); $type = "image/jpg"; if(strlen($data) < 1) { header("Location: ./images/nopicsubmitted.jpg"); } else { //header("Content-type: $type"); header("Content-Type: application/octet-stream"); echo $img; } Can anyone spot if i've made a mistake, used wrong function or syntax etc?
Resize Uploading *.gif Image For Image Display And Thumbnail
how to resize the uploading *. gif image...for display image size and thumbnail size...Okay I know how to do a uploading image...only for resizing part kind of lost it...because I find all tutorial not suit for what I look after..Ok the idea is.. when I upload image ..the php will resize the image into two type size and put into two folder "folder for images" and "folder for thumb" and size for all this type of image are...images = 100x100 thumb = 80x80 with same name file.
Creating Watermark With Another Image & Resizing Watermarked Image
I have a script that watermarks an image; it adds a transparent gif over my base image. I also have a script to resize my image. But here is where the problem comes in; these are two different scripts - none of the code will interconnect (variable wise - that is), so I am having a problem trying to piece together a PHP GD Image code that will create a watermark and will then be resized. Below is my code for resizing my image, but from there - I know I need to use imagecreategif somewhere and imagecopy somewhere; but where, I do not know. Code:
How To Get Folder Name Out Of
An easy one for somebody, but I have not got my head round it yet. I need to get the folder name out of a URL ie: /support/desktop/documents/general/fa95e9e698c76fdc606f3b94fe89b48b/17_Import_data_en.pdf $folder = fa95e9e698c76fdc606f3b94fe89b48b;
PHP 5.2 Doesn't Have Ext Folder?
I just downloaded and installed php v5.2, Apache 2.2 and mysql 5.0.27. I'm having the same problems as many regarding the "undefined function" error and am trying to work through it, but I'm noticing (via many of these troubleshooting tutorials) that people are talking about an "extensions" folder and a php-recommended.ini file and the such, and I notice that I don't have either in my installation of 5.2. Did I download the "preferred" installation package? The one I downloaded is called php-5.2.0-win32-installer.msi. I'm coming from a php 4.4.2 apache v1.3.31 and mysql v4.0.20a - all of which was lost during a major crash so I have nothing to compare these 5.2 files against. If I've downloaded a "non-preferred" installer, could someone tell me which one I should install to get everything working properly -- or at the least to have a complete package.
Folder Name As A GET?
I currently have a website and would like to be able to give my members an alias to access their profile. At the moment, people have to go to something like www.domain.com/viewmember.php?id=3456, which isn't practical unless it's through clicking links. I'd like to be able to give my members the ability to use something like www.domain.com/myname, which would then forward to the correct page. The problem I can see is that the server thinks myname is actually a folder and returns a 404 error. Does anyone know of a way to do this?
Check For Folder
how would i check if there's at least one folder in the current folder? the current folder is $dir/$f/ this is what i have, but i know its wrong $fillle = "$dir/$f/"; if (file_exists($fillle)) {$Q="true";} else{$Q="false";}
Folder Retrieval
I have managed to retrieve a list of pdfs that are in a folder and displayed them with a link to a new window: <?php //RETRIEVES FOLDERS CONTENTS $dir = "/var/www/html/bbcl/building/projects/pdfs"; $folder = "/bbcl/building/projects/pdfs/"; $handle = opendir($dir); while ($file = readdir($handle)) { if ($file != "." && $file != "..") { echo "<a href="$folder$file" target=new>$file</a><br>"; } } ?> But it also display's the name of folders that live there, anyway of specifing what file extensions to appear in the list?
Rename A Folder
Is there an easy way to rename a folder? A function I am missing?
Getting And Using Contents In A Folder
I want to make a photogallery/slideshow with PHP... The 'gallery/slideshow' would show up inside a new window. basically, I just want links with possibility to go: - forward - back - to the very beginning - to the very end - away (close the window) Can I use PHP to determine the contents of the folder with the pictures and then use variables to determine which photo to show, and what URL's should be generates for the arrows? So each folder with a series of photographs would have one PHP file and the pictures themselves in them (it's not a problem to rename them). Should be simple enough, but I'm just starting out with PHP, and I'd like to have something working as soon as possible... the website I'm working on is about to launch soon (my first 'commercial' web project :) ), and this is about the only thing left that I still have to sort out how to do...
Size Of Folder
how i get the size in k of a certain folder on mysite, i know i've done this before but can't think of what to look under at php.net.
Current Folder
Does anyone know easy way to find out the current folder where the script is? I tried to this but it doesn´t work in my Linux web-server, but it works in NT-desktop. $dir1 = getenv(PATH_INFO); $last = strrpos($dir1, "/"); $dir2 = substr ($dir1,0, $last); $name = strrpos($dir2, "/"); $folder = substr($dir2,$name+1,20);
Folder Permission
I have a problem when i create a folder using the following php code: <?php mkdir ("foltest/bleh", 0777); ?> The problem is that the folder "bleh" doesn't have the 777 permission like I wish it did, but it has 755 instead. Is there something wrong with my code, or could this be caused by my host?
Folder Browser
I'm looking for some sort of php folder browser - basically if i have the following folders; index index/welcome help help/email help/web docs in one pull down will display the folders index, help, and docs - where as menu 2 will display the folders that lie in index, help or docs.
The Root Folder
I've a web site in the address http://mySite.com in the root, I've a file index.html I've some subfiolders insid root/sub1/sub2 I like to add an html file (or php) index.html that call the index.html of the root (in order to protect) Now I've created 2 different index.html because I use relative path to design the root (../index.html and ../../index.html) I like to have the same file in all folders,but I don't know how to call the root folder.
Folder Permissions
My trouble might be simple, but I'm quite new to php, and, perhaps I'm even more simple. It's that I had to chmod 777 two folders to get my scripts do what I wanted them to do, and I don't like it. I have a script running on my ISP's unix-apache -server. It is to read string from a form, and create a text-file in a subfolder 'txt' from it. The essential parts of the script is here: $fnam=$HTTP_POST_VARS[filename]; $handle =fopen("txt/".$fnam, "w"); $teksti=$HTTP_POST_VARS[tekstikentta]; touch('txt/'.$fnam); fwrite($handle,$teksti); fclose($handle); Can't be simpler. This script didn't work until I did a chmod777 for both folders, the one where this script is, and the 't' subfolder. Is there a way to get around this?
Folder Loop
i have a folder called "profile_images" how do I loop through the images in this folder, and echo each filename guys?
Getting Contents Of Folder
I've made half of the code for a little "hosting" site for a few of the members of my site. Their files are uploaded to /login/<username>/ I'm now stuck as to how to show the contents of the folder in a page. I think the use of fopen() is needed, however the php website is a little confusing.
Getting The Size Of A Folder
All Ive been trying to do is make a short php script (embedded in the html, no separate file) that simply displays how much space, in megabytes, the contents of a certain folder is taking and use an echo command to display it. I've tried the filesize command and it always gives me 4,096 regardless of the contents. I assume this is because PHP is taking the size of the actual folder. I've tried disk_total_space but this displays a number that is completely off.
Deleting Folder
is there anyway of deleteing a folder and deleting all of its contents with it? i know that with rm_dir needs to folder to be emptied
How Much Space A Folder Is Taken Up
How is everyone? Well I was just wondering if somebody got teach me how to make a PHP Script which tells you how much space a folder is taken up? Example: I have a folder called ./files, I want a script which will tell me howmuch space its taken up .
Check If A Folder Contains Anything
what do I use to check if a directory contains anything. For example how do I check if there is anything in this? (Which in english is something like news/download/may2007/document1.doc UPLOADS_PATH.'/news/download/'.$oDownload->download_path.'/'.$oDownload->download
Copy Folder?
I want to copy a folder, subfolder, files, and subfiles. I don't care about attributes. I thought about making the folder a zip, and then using extract but that was confusing and took too long on the server. so what do I do? Is there a script that will parse the dir and COPY all the files?
Folder Permission 777
I need to upload pictures for a photo gallery but in order to work the upload, the folder's permissions must be 777. ( or am I wrong?). chmod 777 as read thousand times is not secure so what can I do? Check if the folder and change the permissions before and after the upload? Is this secure?
|