rwilliams1961 Posted June 25, 2013 Share Posted June 25, 2013 I hired someone to write PHP code, and he did - partially. I realized it was partial too late. I now have poorly and incomplete code. I tried to write this myself, but need help, as it's very complicated.I have a series of pages. Most are child pages. One is not. Each page has its own images folder. The folders with parents are named parent-child. The folder without a parent is simply named child.The images in the folder are named parent-imagename.jpg. (The page without a parent has images named child-imagename.jpg.)The imagename is where it gets tricky. "Some" imagenames include attributes, and the attributes are separated from the imagename by a hyphen. (Examples: imagename-red.jpg and imagename-blue.jpg.) An actual example is this: paper_shopping_bags_eurototes_inverted_trapezoid_matte-garnet.jpg. Finally, each folder has a "thumbs" sub-directory.That's the overview. Now, what I'm trying to do:1. Read image into an array.2. Echo image to screen.3. If image has attribute(s), echo it/them. (They reside in the thumbs sub-directory.)4. Finally, echo thumbnails of all images to screen (but only one thumbnail per imagename. In other words, if an image has five attributes, still only print one thumbnail for that image.)To be really honest, I have jack for code, and I'm having to wrap this within the next few hours. I was left high and dry and I'm struggling with each step of this. The starting code I have I'll print below. How little I've managed to get is embarrassing. If you don't mind helping...<?php$parent = get_page($post->post_parent);$parent_slug = $parent->post_name;$page_slug = $post->post_name; // SET VALUE OF DIRECTORY$root_path = $_SERVER{'DOCUMENT_ROOT'};$dir_path = '/trophy/wp-content/gallery/'.$parent_slug.'-'.$page_slug.'/*.jpg'; // SET VALUE OF DIRECTORY$full_root = $root_path.$dir_path;$full_url = $url_path.$dir_path;$image_name = '*.jpg'; // VARIABLE USED TO SEARCH FOR IMAGES$images = glob($full_root.$image_name); // SEARCH FOR IMAGES?><div class="dir-container"> <div class="image-container"> <?php foreach(glob($full_root) as $file) {THIS IS WHERE I START GETTING LOST. WHAT I THINK I NEED TO DO IS READ EACH IMAGE INTO ARRAY. SO AN IMAGE WITH 3 ATTRIBUTES WOULD BE READ imagename[0,0], imagename[0,1], imagename[0,2], imagename[0,3]. WRITE imagename[0,0] TO SCREEN. THAT IS THE LARGE IMAGE. WRITE imagename[0,1],[0,2],[0,3] FROM THE THUMBS FOLDER TO THE ATTRIBUTES SECTION OF SCREEN. WRITE imagename[0,0] FROM THE THUMBS FOLDER TO THE THUMBS SECTION OF SCREEN. CREATE HYPERLINK UNDER IMAGES IN THUMBS SECTION THAT WILL REPLACE ENLARGED IMAGE WITH NEW IMAGE AND ECHO ATTRIBUTES FOR NEW IMAGE TO ATTRIBUTES SECTION. READ NEXT IMAGE. } ?> This is my problem. It's huge. Is anyone up to helping with this HUGE issue? I have jack for money, but might by Tuesday PM. Maybe. Anyone? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.