Luca Crippa Posted November 3, 2013 Share Posted November 3, 2013 Hi! I have this script, which takes a folder of photo in order to create a photogallery. <script type="text/javascript"> $(function(){ $('#screenshotGallery').galleryView({ panel_width: 637, panel_height: 358, frame_width: 100, frame_height: 54, show_filmstrip_nav: true, show_infobar: true }); });</script> The problem is that a vertical image doesn't seem to be accepted, because this script deforms it to an horizontal image. Is there a script that automatically takes a vertical image and adds to it two black lateral bands, literally trasforming it in a "false" horizontal image? Thank you! Link to comment Share on other sites More sharing options...
davej Posted November 3, 2013 Share Posted November 3, 2013 Wouldn't you simply allow the div height to auto-size and set the background color to black? Link to comment Share on other sites More sharing options...
dsonesuk Posted November 3, 2013 Share Posted November 3, 2013 try adding panel_scale: 'fit', frame_scale: 'fit' Link to comment Share on other sites More sharing options...
Luca Crippa Posted November 4, 2013 Author Share Posted November 4, 2013 Love it!!!! Thanks! Link to comment Share on other sites More sharing options...
Luca Crippa Posted November 4, 2013 Author Share Posted November 4, 2013 Now, just to finish my script: <?php // Definizione dei path $path_gall = '../public/gallery'; $dirs = scandir($path_gall);foreach ($dirs as $cartella) { if($cartella == '.' || $cartella == '..') { continue; } $name = $cartella; $name = str_replace("_", " ", $name); // risostituisco gli underscore con gli spazi $name = str_replace("!a!", ", ", $name); // metto la virgola e lo spazio tra anno e mese $name = str_replace("!b!", " - ", $name); // metto il - tra anno e titolo $path_cart = "$path_gall/$cartella"; $inner = scandir($path_cart); echo "<a name = "$cartella"></br></br>"; echo "<h5>$name</h5></br>"; echo "<div style="width: 640px;">"; echo "<ul id="screenshotGallery">"; foreach ($inner as $photo) { if($photo == '.' || $photo == '..') { continue; } echo "<li><img src="$path_cart/$photo" /></li>"; } echo "</ul></div></br></br>"; }?> I have this script, which takes all my photo folders and prints it on separate galleries. How can I insert an if statement that controls if the folder is empty in order to avoid to create the relative gallery? The problem is that every folder is not really empty, in fact there are certainly the "." and the ".." folders! Link to comment Share on other sites More sharing options...
justsomeguy Posted November 4, 2013 Share Posted November 4, 2013 Instead of using echo statements for all of the HTML, build the HTML content in a variable. You can use a variable to keep track of whether you've found a valid file, and after the inner loop you can check that variable before echoing the HTML content. Link to comment Share on other sites More sharing options...
Luca Crippa Posted November 6, 2013 Author Share Posted November 6, 2013 Instead of using echo statements for all of the HTML, build the HTML content in a variable. You can use a variable to keep track of whether you've found a valid file, and after the inner loop you can check that variable before echoing the HTML content. This will help me to select empty folders in order to not display them? Link to comment Share on other sites More sharing options...
justsomeguy Posted November 6, 2013 Share Posted November 6, 2013 If you know which folders are empty then you can choose to display them or not. If you have a variable that tells you if anything is in a certain folder then you will know whether or not it is empty. Link to comment Share on other sites More sharing options...
Luca Crippa Posted November 11, 2013 Author Share Posted November 11, 2013 (edited) <?php // Paths $path_gall = '../public/gallery'; $dirs = scandir($path_gall);foreach ($dirs as $cartella) { if($cartella == '.' || $cartella == '..') { continue; } $name = $cartella; // Creating the layout of the name of the gallery $name = str_replace("_", " ", $name); $name = str_replace("!a!", ", ", $name); $name = str_replace("!b!", " - ", $name); $path_cart = "$path_gall/$cartella"; $inner = scandir($path_cart); $gallery = "<a name = "$cartella"></br></br> <h5>$name</h5></br> <div style="width: 640px;"> <ul id="screenshotGallery"> foreach ($inner as $photo) { if($photo == '.' || $photo == '..') { continue; } echo "<li><img src="$path_cart/$photo" /></li> } </ul></div></br></br> "; if (!empty($path_cart)) { echo $gallery; } }?> Not working! Not showing photos! Edited November 11, 2013 by Luca Crippa Link to comment Share on other sites More sharing options...
justsomeguy Posted November 11, 2013 Share Posted November 11, 2013 You have PHP code inside the string. It's not going to execute that code, it's going to print the actual PHP code. Move that code outside of the string. Link to comment Share on other sites More sharing options...
Luca Crippa Posted November 13, 2013 Author Share Posted November 13, 2013 <?php // Definizione dei path $path_gall = '../public/gallery'; $dirs = scandir($path_gall);foreach ($dirs as $cartella) { if($cartella == '.' || $cartella == '..') { continue; } $name = $cartella; $name = str_replace("_", " ", $name); // risostituisco gli underscore con gli spazi $name = str_replace("!a!", ", ", $name); // metto la virgola e lo spazio tra anno e mese $name = str_replace("!b!", " - ", $name); // metto il - tra anno e titolo $path_cart = "$path_gall/$cartella"; $inner = scandir($path_cart); foreach ($inner as $photo) { if($photo == '.' || $photo == '..') { continue; } $gallery1 = "<center><a name = "$cartella"></br></br> <h5>$name</h5></br> <div style="width: 640px;"> <ul id="screenshotGallery"> "<li><img src="$path_cart/$photo" /></li> </ul></div></br></br> </center> }"; } if (!empty($path_cart)) { echo $gallery1; } }?> This is working. I didn't understand what was your point, but I'm fine Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now