PHP - Question Regarding The Organizing Photos In Flickr -favs - How To Put Them In Certain Folders
hello dear php-experts,
well today i have a question regarding the organizing photos in flickr -favs how to do that ? i have 1500 favorites. now i want to organize them into certain " subfolders " or directories question: is this possible? any ideas - i look forward note: i have seen that i am able to download all favs automatically _ great thing but that is another story. Similar Tutorialsso is it impossible if I have a users folder and a messaging folder located in the same folder. To have a script in the users folder reading from the messaging folder from a script in the messaging folder i thought i could just do this to read the users folder but apparently not Code: [Select] <? require("users/menu.php"); ?> I am trying to pull in the latest Flickr images from my account and using magpierss to parse the feed. I am successfully creating a ul list of the images using the code below, but I cannot see how to size the images, can anyone help. The $item['description']; line produces: Username posted a photo: FlickrImage <? require_once 'magpierss/rss_fetch.inc'; $url = ''; $rss = fetch_rss( $url ); echo '<ul>'; foreach ($rss->items as $item) { $href = $item['link']; $title = $item['title']; $img = $item['description']; echo "<li><a href=$href>" . $img . "</a></li>"; } echo "</ul>"; ?> http://ahy4life.com/test2/press.php I am following the tutorial below: http://www.adambate.com/how-to-add-a-flickr-based-photo-gallery-to-your-website-phpflickr-lightbox/ I am encountering errors when I introduce the code below. Not sure what is causing it. The flickr photo set is named 'AHY' . php and js <CODE> <script type="text/javascript" src="photos/lightbox2.05/js/prototype.js"></script> <script type="text/javascript" src="photos/lightbox2.05/js/scriptaculous.js?load=effects,builder"></ script> <script type="text/javascript" src="photos/lightbox2.05/js/lightbox.js"></script> <?php require_once("photos/phpFlickr-3.1/phpFlickr.php"); $f = new phpFlickr("b16911dd0ec59f16ed66e80711edbdaf"); // API $user = "ahy4l@yahoo.com"; $ph_sets = $f->photosets_getList($user); ?> </CODE> <CODE> <!-- Photo Gallery --> <div id="gallery"> <?php foreach ($ph_sets['AHY'] as $ph_set): ?> <div class="photosets"> <p><h2><?php print $ph_set['title']; ?></h2></p> <?php $photoset_id = $ph_set['id']; $photos = $f->photosets_getPhotos($photoset_id); foreach ($photos['AHY']['photo'] as $photo): ?> <div class="photos"> <a rel="lightbox[]" href="<?= $f->buildPhotoURL($photo, 'medium') ?>" title="<?= $photo['title'] ?>"> <img src="<?= $f->buildPhotoURL($photo, 'square') ?>" alt="<?= $photo['title'] ?>" title="<?= $photo['title'] ?>" /> </a> </div> <?php endforeach; ?> </div> <?php endforeach; ?> </div> The CSS I use for this is: #gallery { position: relative; float: left; width: 600px; padding: 0px 15px 10px 15px; } .photos { position: relative; float: left; display: block; padding-bottom: 10px; } .photosets { clear: both; padding-top: 1px; } .photosets h2 { color: #000; } </CODE> Hi Everyone,
Someone is asking me a bit of help on a website, I know a bit php and HTML5, I would like to know what would be the best of doing this please:
1)I need to create 2 big buttons, according to the choice of the buttons a different dropbox menu with towns will showup.
2)When the user chooses one of the town, in any drop down, I would like to show a different DIV with content in it.
Here is a practical example:
BUTTON A BUTTON B
if Button A is pressed, show dropdown menu A
if BUTTON B is pressed, show dropdown menu B
If town 1 from dropdown menu A is chosen show DIV 1
If town 2 from dropdown menu A is chosen show DIV 1
If town 3 from dropdown menu A is chosen show DIV 2
If town 4 from dropdown menu A is chosen show DIV 3
If town 5 from dropdown menu A is chosen show DIV 1
If town 1 from dropdown menu B is chosen show DIV 6
If town 2 from dropdown menu B is chosen show DIV 5
If town 3 from dropdown menu B is chosen show DIV 5
If town 4 from dropdown menu B is chosen show DIV 6
If town 5 from dropdown menu B is chosen show DIV 4
How to do this without reloading the page please?
Thank you,
Bambinou
I have a test database set up that I am working on. Right now, just some names like so firstName lastName companyName I have used phpmyadmin to insert names in the database. Right now just three names are inserted. One first and last name, one first name and one company name I am getting the results back in an associative array. How can I echo out the information with the break tag, or one field at a time? if I use a break tag, then the loop adds in extra blank lines when it gets to the first name and it's null. Can I test for null values and do it that way? I am a beginner so I have no idea what I am doing. Code: [Select] $result = $mysql->query("select * from names") or die($mysql->error); if($result){ while($row = $result->fetch_assoc()){ $name = $row['firstName']; $lastName = $row['lastName']; $company = $row['companyName']; echo $name . " "; echo $lastName . " "; echo $company . " "; } } So I'm calling in data from a DB where each record is associated with a (column) 'start_time', 'no_shows', 'cancelled', and 'attended' I want to go through the results of this SELECT and count the number of no shows, cancellations and attended on a WEEKLY basis (based on the start_time). How can I achieve this?
The user will provide a date range and the DB will select the records based on that date range. Now this date range will then have to be split by weeks and then get the count. I'm totally stuck on the counting by weeks part. This is what I have so far: // Multidimensional Array with [boolean][week #] $no_shows_weekly = [ 'no_show' => [], 'week' => [] ]; $cancelled_weekly = [ 'cancelled' => [], 'week' => [] ]; $attended_weekly = [ 'attended' => [], 'week' => [] ]; foreach($result as $r) { $start_time = new DateTime($r['start_time']); if($r['is_no_show'] == 0 && $r['is_cancelled'] == 0) { array_push($attended_weekly['attended'], 1); array_push($attended_weekly['week'], date_format($start_time, "W")); } else { array_push($attended_weekly['attended'], 0); array_push($attended_weekly['week'], date_format($start_time, "W")); } array_push($no_shows_weekly['no_show'], $r['is_no_show']); array_push($no_shows_weekly['week'], date_format($start_time, "W")); array_push($cancelled_weekly['cancelled'], $r['is_cancelled']); array_push($cancelled_weekly['week'], date_format($start_time, "W")); } echo json_encode(array( 'success'=> 1, 'msg'=> array( 'No Shows' => $no_shows_weekly, 'Cancellations' => $cancelled_weekly, 'Attendend' => $attended_weekly ) )); Any suggestions or help is greatly appreciated! I have two related websites which utilize the same database: Main website for public use. Admin website for administration purposes.Currently, I have both located in /var/www/combined-app which is a single git repository and contains the following: /var/www/combined-app/ public/ public-admin/ src/ main/ admin/ vendor/ composer.json bootstrap.php Alternatively, I could have done the following: /var/www/combined-app/ main/ public/ src/ vendor/ composer.json bootstrap.php admin/ public/ src/ vendor/ composer.json bootstrap.php Or maybe something else all together? Is one approach typically better than the other? If so, please provide reasons why. If my second example, would you recommend separate git repositories for main and admin? Thanks I have a file upload script that will eventually process a ton of files. I would like to upload them into sub-directories according to what year, month, and day they are uploaded.
A typical tree should look like this:
attachments/
--/2014
-----/January
--------/01
--------/02
--------/03 , etc.
-----/February
--------/01
--------/04
--------/09
--------/18
--------/20, etc
-----/March, etc
--/2015, etc.
So a file called image.jpg uploaded on 10/31/2014 would have a URL of attachments/2014/October/31/image.jpg. I understand that every time a file is uploaded, the script would have to detect through FTP whether or not folders for the year, month, and day exist, and if they don't create them. My problem is that I have no idea what the logic of this script would be. What order should I do things in? Is there a way to use maybe foreach to detect/create the folders? Any input would be appreciated.
I am refactoring entire collective scattered SQL from my legacy codebase, and into separate classes, and looking for some structure to put it into. Right now I have folders effectively called `DataFromDB` - contains classes that accepts whatever parameters are given, and returns pure data back to the user `DAO` - Data Access Object, which takes that raw data from DB and makes sense out of it and prepares it for consumption by the model/business logic layer objects. That is: - src (folder) |- DAO (folder) | - ProductADAO (classes - take data in, return consumable objects out) | - ProductBDAO | - ... | - ProductZDAO |- DataFromDB (folder) | - ProductAData (classes - contain methods to query pure result sets from DB) | - ProductBData | - ... | - ProductZDataWhenever I need to make a new SQL or refactor an old one I do this: What is this SQL doing? Is it operating on `SomeObjectX`? If yes, find/create class called `ObjectX`, and add a method to it, extracting pure data from DB, put it into `DataFromDB` folder. Write the `DAO` object if needed to transform data into a consumable object. Use the object as is in my code. Does this look like a good strategy? Is there a better one? My problem with this one is that before (now) all the SQL is tightly coupled and is included into the multiple business classes. Using the above strategy will mean I am to be creating many many classes, a lot of classes, most likely one for every few SQL statements. The pros is that it seems like I will achieve a level of code modularity that I wanted. Hey guys i am making a php application and i have a feature where it allows members to upload images. If there a way to secure a folder to only be allowed access when a member is logged in and not someone accessing the folder and downloading images. Stuped question i know would it be better to store the images in the database as BLOB? but then again could make the database big. Thanks Hi all, we are new bee to php, I am developing a project that has config and other sub folders under admin directory ROOT/ADMIN, ROOT/ADMIN/FOLDER1,2,3... how to manage redirection from one file to another folder. Im using XAMPP at the moment and my applicatin im making is in a folder in the htdocs folder where all my files are read from. I notice when im php scripting if I put any files into another folder with in my main folder it wont load the page. so when I want to load a .php file from a script do i need to add more then just go to this .php file? I tried adding folder/*****.php but that didnt work I want to use multiple folders so its more organized hope someone can help me out with this Hi All - hope someone has done this before. I need to create a PHP script that detects the presence of a new file appearing into a folder, and process it. This HAS to be supported by Windows IIS (Have looked at FAM for Linux but can't use it). I could do a loop with some sleep that checks the directory every x seconds - but this has been discounted by the client as either a) too resource hungry or b) not quick enough if there is a delay. Add ons, extensions or even external 3rd party tools would all be acceptable. Any ideas? Phil I have written a rule that if a file doesn't exist, then look for it in "sub1" folder, for example: when someone goes to www.example.com/file15 it will rewrite to -> www.example.com/sub1/file15, and it works
RewriteEngine On But there are more folders than sub1, so if a "file15" doesn't exist in sub1, then look for it in folder sub2, and if it's not in sub2, then rewrite to sub3. I tried this but doesn't work:
RewriteEngine On
I have seen many web sites that will have there page set up with a directory structure instead of the ?x=f&a=s... for example shapeways has for each product a page like this: http://www.shapeways.com/model/194992/ They are not generating a folder and index.php for each product because you can type any file name you want in after the / and you will still get the same page. Was wondering how it is done as it makes much more human remember able addresses. How do you count the number of folders in a directory? Hi folks, Working on something and I'm not sure how best to do it. It's a system whereby customers can login and see pdf files. Each customer has a unique reference number which is mirrored with a folder on the server, the folder name being the customer reference number. That's the first bit of checking. Then, within that customer folder there will be between 1 and X sub folders which are labelled by unique product reference numbers. Beyond that, each of the product reference folders will have a year folder with a folder for each month of the year going forward. Here's an example of the folder structu - Customer Number (e.g. 12345678) - Product Number (e.g. 456789) (could be more than one) - Year (e.g. 2011) (could be more than one) -Month (e.g. 01/02/03/04/05/06 etc) Essentially, I'm just unsure how to check if folders exist and display their contents if they do. Here's my code so far, which does the first part of checking to see if the product numbers exist, but not the folder checking (I've not activated the hyperlinks in this code yet). This doesn't go as far as years and months yet, just the product number: Code: [Select] $query = mysql_query("SELECT * FROM customers where id = '$id'"); while($rst = mysql_fetch_array($query)) { echo "$rst[company_name]"; } $query = mysql_query("SELECT * FROM sites where company_name = '$company'"); while($rst = mysql_fetch_array($query)) { echo "$rst[site]<br>"; if ($rst[product1] !== ""){ echo "- <a href='#'>$rst[product1]</a><br>"; } if ($rst[product1] == ""){ echo ""; } if ($rst[product2] !== ""){ echo "- <a href='#'>$rst[product2]</a><br>"; } if ($rst[product2] == ""){ echo ""; } if ($rst[product3] !== ""){ echo "- <a href='#'>$rst[product3]</a><br>"; } if ($rst[product3] == ""){ echo ""; } if ($rst[product4] !== ""){ echo "- <a href='#'>$rst[product4]</a><br>"; } if ($rst[product4] == ""){ echo ""; } if ($rst[product5] !== ""){ echo "- <a href='#'>$rst[product5]</a><br>"; } if ($rst[product5] == ""){ echo ""; } Hi, How do you create a folder in the main dir (public_html) when you are a few folders deep? My code... mkdir("../../../../../filestore/images/$page_id/", 0644); I seem to get an error each time failing to create the folder. Is there away to go direct to the public html folder? Thanks for any help. i have some questions on how folders and files permissions work. say i have users directories outside 'protected' as below.. Code: [Select] users -- usera -- docs -- userb -- docs protected i do not want user B who does not have the rights, to access anything in user A directories. also, i do not want any person to access the directories directory via url links. basically i just want users to be able to access their own directories, and no one else. how can it be done? thanks! G'day, on the home page of a website i'm building, i'm wanting to have a random photo that looks at all the subfolders of the gallery directory, but the best I can achieve is just one subfolder. Here is the code, if anyone can assist, that'll be appreciated. <?php function getRandomFromArray($ar) { mt_srand( (double)microtime() * 1000000 ); $num = array_rand($ar); return $ar[$num]; } function getImagesFromDir($path) { $images = array(); if ( $img_dir = @opendir($path) ) { while ( false !== ($img_file = readdir($img_dir)) ) { // checks for gif, jpg, png if ( preg_match("/(\.gif|\.jpg|\.png)$/", $img_file) ) { $images[] = $img_file; } } closedir($img_dir); } return $images; } $root = ''; // If images not in sub directory of current directory specify root //$root = $_SERVER['DOCUMENT_ROOT']; $path = 'gallery/topic1/'; // Obtain list of images from directory $imgList = getImagesFromDir($root . $path); $img = getRandomFromArray($imgList); ?> <center><a href="?GoTo=Photo Gallery"><img src="<?php echo $path . $img ?>" alt="" height="267" width="400"/></a></center> |