Jump to content

Recommended Posts

it is a dinamic list

 

my page look like this and all files shows like thay are a picture

<?php
include('templates/' . $__config['template'] . '/header.php');
include('templates/' . $__config['template'] . '/menu.php');
include('templates/' . $__config['template'] . '/menu2.php');

$object->gallery->getPhotos();
?>
<div id="content">
	<h1><?=$object->{'naziv_' . $__language}?></h1>
	<div class="clear"></div>
	<div class="realestate-details">
		<p><?=$object->{'opis_' . $__language}?></p>
		<div class="images-details">
<?php
if (is_array($object->gallery->photos)) {
	foreach($object->gallery->photos as $photo) {
?>
			<a rel="lightbox[image]" rel="photos-<?php echo $object->sifra; ?>" href="/images/cache/objects/<?=$object->id?>/<?=$photo['filename']?>/w-500.jpg"><?
				?><img style=" border-style: solid; border-width: 1px; border-color:#BFC6C8; padding: 2px;" alt="" src="/images/cache/objects/<?=$object->id?>/<?=$photo['filename']?>/h-100.jpg" /><?
			?></a>
<?php
	}
}
?>

		</div>
            

            
	</div>
</div>
        <div class="clear"></div>

<div style="height:23px; width:1047px; background-image: url(/images/sjena_bot.jpg); margin-bottom:20px;"></div>
<?php
include('templates/' . $__config['template'] . '/footer.php');
?>

 

now i need to sperate pictures from pdf files

 

any help?

if your server is running PHP 5 then you can use the following code...

$dir = 'files/home'; //directory you want to iterate through
foreach (new DirectoryIterator($files) as $fileInfo) {
    if($fileInfo->isDot()) continue; //if listing is a dot dont do anything continue with the script
    if(preg_match("/(\.pdf)+/",$fileInfo->getFilename())) //if the file name contains '.pdf' then...echo location or do something...
    {
    	echo $fileInfo->getFilename() . "<br>\n";
    }
}

http://us2.php.net/directoryiterator 

 

- Cheers!

sorrrrry

 

i have added a wrong page before

 

here is my original page

 

<?php
$photos = getGallery($__config['paths']['photos']['products'] . $product['id'] . '/');
?>
<?php
if (is_array($subcategory)) {
?>
<h2 style="padding-bottom:20px;"><a href="#" onClick="history.go(-1)"><?=$category['title_' . $__language]?>  -  <?=$subcategory['title_' . $__language]?></a></h2>
<?php
} else {
?>
<h2><a style="color:#5C6668" href="/<?=$__language?>/<?=$__query[2]?>/<?=$__query[3]?>"><?=$category['title_' . $__language]?></a></h2>
<?php
}
?>
<div class="product-details">
<h4><?=$product['title_' . $__language]?></h4>
<p><?=$product['description_' . $__language]?></p><br >

<?php
if (is_array($photos)) {
	foreach($photos as $photo) {
?>
<a rel="lightbox[image]" title="<?=$photos[1]['title']?>" href="/images/cache/products/<?=$photo['filename']?>/<?=$product['id']?>/w-480.jpg"><div style="padding-right:5.2px; float:left;"><img src="/images/cache/products/<?=$photo['filename']?>/<?=$product['id']?>/h-100.jpg" alt="<?=$photos[1]['title']?>" title="<?=$photos[1]['title']?>" /></div>
</a>
<?php
	}
}
?>	


	<div class="clear"></div>
	<ul>
<br >


	</ul>
</div>

 

now pictures and pdf files show together, and i cant see pdf files becouse it try to open with jpg extension

 

i need to sperate my pictures and pdf files from jpg files

 

i tryed glob function but i cat make it work becouse of ma poor php knowledge

 

please some sugestion????

 

or how to make that this script shows onley jpg and jepg files?

 

<?php
$photos = getGallery($__config['paths']['photos']['products'] . $product['id'] . '/');
?>
<?php
if (is_array($photos)) {
	foreach($photos as $photo) {
?>
<a rel="lightbox[image]" title="<?=$photos[1]['title']?>" href="/images/cache/products/<?=$photo['filename']?>/<?=$product['id']?>/w-480.jpg"><div style="padding-right:5.2px; float:left;"><img src="/images/cache/products/<?=$photo['filename']?>/<?=$product['id']?>/h-100.jpg" alt="<?=$photos[1]['title']?>" title="<?=$photos[1]['title']?>" /></div></a>
<?php
	}
}
?>	

so is this a 3rd party script?

 

Maybe you can get some help from the creators?

 

whats the name of the script your using?

 

I'm not entirely sure how the code works, but look like it was design explicitly for use with images... My guess is this information is passed on to yet another script which handle the image request and such...

 

Also I think the getGallery function gets all the files...you need to add a conditional statement  like...

if(preg_match("/(\.pdf)+/",$photo)) //if the file name contains '.pdf' then...echo location or do something...
    {
    	echo "this is a pdf<br>\n";
    }
else
{
    echo "this is a regular jpg<br>\n";
}

 

 

Also, how much PHP do you know? how new are you to this?

 

daniel im trying and trying it myself but i cant get it work

Next try, post it here and we can point you in the right direction....

 

Cheers!

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.