![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
Dorky
-
Posts
287 -
Joined
-
Last visited
Never
Posts posted by Dorky
-
-
ok i got the name and url into a sortable format in the file and can pull it in the order i want it. any advice on how to remove 1 entry from an array so i can write all but the defined $var back to the file.
-
sweet, i just realized to pull the same data so i can populate the delete list i need to create a 2x array for each entry. one $var for the name and one $var for the url so i can pull from the same file to populate the delete list and the visitor side. i will need to be able to pull by $var[] and not sure how yet im going to give a distinction to each array. an array of arrays?
any advice on engineering this is very appreciated.
-
got a file, lets call it file a. file a has links stored in it so they can be used by include to populate a links list managed by the site owner. i need to figure out how to make the entry go to the next line instead of inline every time it gets added to. and how to delete the line from the array i pull it into. i know how to pull each line into the array and how to write each link to it, just not real well at organizing it.
-
you could just use a for loop. im assuming you want to do some image upload kind of thing
for ($i = 0; $i < count($_POST['new_image']['name']); $i++){ //access each individual element like so $name = $_POST['new_image']['name'][$i]; $size = $_POST['new_image']['size'][$i]; //do rest of stuff }
DUDE YOU ARE THE MAN!!!!!
for ($i = 0; $i < count($_FILES['new_image']); $i++){ $imagename = $_FILES['new_image']['name'][$i]; $tmp_name = $_FILES['new_image']['tmp_name'][$i];
how long did that take you. i missed an entire nights sleep for that.
-
i have been all over the web trying to figure this out. please help!
-
outside Array
(
[name] => Array ( [0] => d.png [1] => sky.jpg )
[type] => Array ( [0] => image/png [1] => image/jpeg )
[tmp_name] => Array ( [0] => /tmp/phpeKr1qV [1] => /tmp/phpiII3hp )
[error] => Array ( [0] => 0 [1] => 0 )
=> Array ( [0] => 1028 [1] => 110116 )
)
inside Array ( [0] => d.png [1] => sky.jpg )
inside Array ( [0] => image/png [1] => image/jpeg )
inside Array ( [0] => /tmp/phpeKr1qV [1] => /tmp/phpiII3hp )
inside Array ( [0] => 0 [1] => 0 )
inside Array ( [0] => 1028 [1] => 110116 )
-
yeah i figured that out but i have no idea how to get this into a workable array. it doesnt keep the right structure for some reason. this is the structure before and after the foreach loop indicated by "inside" and "outside"
outside Array ( [name] => Array ( [0] => d.png [1] => sky.jpg ) [type] => Array ( [0] => image/png [1] => image/jpeg ) [tmp_name] => Array ( [0] => /tmp/phpX40sIK [1] => /tmp/php1TmAiS ) [error] => Array ( [0] => 0 [1] => 0 ) => Array ( [0] => 1028 [1] => 110116 ) )
inside Array ( [name] => [type] => [tmp_name] => [error] => 4 => 0 ) inside Array ( [name] => Array ( [0] => d.png [1] => sky.jpg ) [type] => Array ( [0] => image/png [1] => image/jpeg ) [tmp_name] => Array ( [0] => /tmp/phpX40sIK [1] => /tmp/php1TmAiS ) [error] => Array ( [0] => 0 [1] => 0 ) => Array ( [0] => 1028 [1] => 110116 ) )
-
i cannot find how to break down an array from multiple image post into a usable array to use in a foreach loop?
results from a print_r of the $_POST['new_image']
Array ( [name] => Array ( [0] => d.png [1] => sky.jpg ) [type] => Array ( [0] => image/png [1] => image/jpeg ) [tmp_name] => Array ( [0] => /tmp/php6WChM0 [1] => /tmp/phpU1UV9g ) [error] => Array ( [0] => 0 [1] => 0 ) => Array ( [0] => 1028 [1] => 110116 ) ) Array ( [0] => d.png [1] => sky.jpg ) Array ( [0] => image/png [1] => image/jpeg ) Array ( [0] => /tmp/php6WChM0 [1] => /tmp/phpU1UV9g ) Array ( [0] => 0 [1] => 0 ) Array ( [0] => 1028 [1] => 110116 )
-
did a print_r its not over writing, its not retrieving all of the images from the form into the array. its only retrieving one in the array.
$filepaths[] = $_FILES['new_image'];
-
if (isset($_FILES['new_image'])) { if (!empty($_POST['address']) && !empty($_POST['city']) && !empty($_POST['state']) ) { //... $filepaths[] = $_FILES['new_image']; $listing = $_POST['address']; mkdir("/home/p14tnue3/public_html/howton/images/gallery/$listing" , 0755 ); mkdir("/home/p14tnue3/public_html/howton/images/gallery/thumbs/$listing" , 0755 ); foreach ($filepaths as $imgkey => $filepath) { $imagename = strtolower($filepath['name']); $charref = substr($imagename, 0, strrpos($imagename, '.')); if(ctype_alnum($charref)) { if (($pos = strrpos($imagename, ".")) === FALSE) { echo "<p class=\"p7\">Fail</p><br />"; exit; } else { $extension = substr($imagename, $pos + 1); $imagename = "$imgkey.$extension"; } if ( $extension == "jpg" || $extension == "gif" || $extension == "png" ) { $source = $filepath['tmp_name']; $target = "images/gallery/$listing/$imagename"; move_uploaded_file($source, $target); $file = "images/gallery/$listing/$imagename"; $save = "images/gallery/$listing/$imagename"; list($width, $height) = getimagesize($file) ; if ($width > "500" ) { $modwidth = 500; } else { $modwidth = $width ; } $diff = $width / $modwidth; $modheight = $height / $diff; $tn = imagecreatetruecolor($modwidth, $modheight) ; if( $extension == "jpg" ) { $image = imagecreatefromjpeg ($file); } if( $extension == "gif" ) { $image = imagecreatefromgif ($file); } if( $extension == "png" ) { $image = imagecreatefrompng ($file); } imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; if( $extension == "jpg" ) { imagejpeg($tn, $save, 100) ; } if( $extension == "gif" ) { imagegif($tn, $save, 100) ; } if( $extension == "png" ) { imagepng($tn, $save, 9) ; } $save = "images/gallery/thumbs/$listing/$imagename"; list($width, $height) = getimagesize($file) ; if ($width > "100" ) { $modwidth = 100; } else { $modwidth = $width ; } $diff = $width / $modwidth; $modheight = $height / $diff; $tn = imagecreatetruecolor($modwidth, $modheight) ; if( $extension == "jpg" ) { $image = imagecreatefromjpeg ($file); } if( $extension == "gif" ) { $image = imagecreatefromgif ($file); } if( $extension == "png" ) { $image = imagecreatefrompng ($file); } imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; if( $extension == "jpg" ) { imagejpeg($tn, $save, 100) ; } if( $extension == "gif" ) { imagegif($tn, $save, 100) ; } if( $extension == "png" ) { imagepng($tn, $save, 9) ; } $imginfo = "Images Uploaded Successfully"; $address = ""; $city = ""; $state = ""; } else { $imginfo = "Invalid or empty File <br>Valid file types .jpg .gif .png"; $address = $_POST['address']; $city = $_POST['city']; $state = $POST['state']; } } else { $imginfo = "Image name may have alphanumeric characters only and no spaces $charref"; $address = $_POST['address']; $city = $_POST['city']; $state = $POST['state']; } } //... } else { $imginfo = "Please complete all fields for listing"; $address = $_POST['address']; $city = $_POST['city']; $state = $POST['state']; } }
-
oh yeah, im running two images for testing
-
i added $imgkey => and use it to rename the file and whats happening is it writes the final image as 0 so its as if my foreach loop isnt advancing thrue the array but it is because it because its running the first image but then overwriting it with the name of the first.
-
$filepaths[] = $_FILES['new_image']; foreach ($filepaths as $filepath) { $imagename = strtolower($filepath['name']); $charref = substr($imagename, 0, strrpos($imagename, '.')); if(ctype_alnum($charref)) {
this is for a form with multiple image uploads that need to be resized. im trying to loop them thrue the resize script but it over writes as it goes untill the only img when its done is the final image field.
-
I have a gallery to build and want to build a dynamic upload form to allow for $var number of fields but have a 30 sec execution limit on my host. im looking for advice on how to loop thrue up to 8 images but running each loop as a single execution so my script doesnt crash due to timeout.
-
- use more space, im using to much space
- its boring and plain, those things are pointless
i dont see as much of a consensus as you all are eluding to. in fact your opinions all pull back and forth and other then the scaling issue are just opinions and not backed up with any facts or even links to any facts. i love that you all are helping but im done with this thread.
- use more space, im using to much space
-
textarea with a javascript button.
-
put this as the first entry in your css
* { margin: 0px; }
and go from there.
-
if you must use the bg you have try blending the edge with a shadow and use
background-position:
-
i will fix spelling, sentence structure and grammar. first i wanted to get some input on what i have and what dont.
-
<html> <head> <style> body { background-color: #000000; color: #ffffff; } #box {position: relative; width: 750px; height: 100%; margin-left: auto; margin-right: auto; } #box h1 { color: #ff0000; text-align: center; } #box img { border: 0px; } #box .Banner { border-style: solid; border-width: 1px; border-color:red; width:750px; height:150px; float:left; } #box .leftmenu { background-color: #990000; border-style: solid; border-color: #990000; border-width: 1px; margin-right:5px; margin-bottom:100px; margin-top:5px; width:200px; height:100%; float:left; } #box .Content { width:500px; height:100%; text-align: center; float:left; } </style> </head> <body> <div id="box"> <div class='banner'><h1>Banner Here<h1></div> <br /> <div class='leftmenu'><a href='Signup.php'><img src='signup.png' /></a></div> <div class='Content'>....</div> </div> </body> </html>
-
by no way am i saying i validate my sites because to me valid is working in the major browsers. but this is a good way to check quickly for errors
this is it
this is you site on the w3 validator.
they have one for css as well
-
remember to design so it looks like it should with an html only browser without relying on <meta or <!if tags
-
Why did you feel the need to start three threads on the same topic. How annoying.
im sure you noticed the "GOD" part of her site. she is spreading the "WORD" lmao. its religious spamming.
-
when working with backgrounds if it doesnt refresh with the changes you made, try clearing the browser cache.
flat file
in PHP Coding Help
Posted
ok im down to this. it returns the altered array but i dont have a clue about how to get this back into a string with the top level array ending in /n and deviding the lower level array with ||
linkname || linkurl.com
linkname || linkurl.com
linkname || linkurl.com
linkname || linkurl.com
is the desired flat file format im trying to get the array down to.