Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-04-14 18:29:55

soulship
Member
From: Always Sunny Charleston
Registered: 2004-04-30
Posts: 669
Website

Get images from a txp category into an array dynamically....Any Ideas?

Playing with a script and would like to create a simple array from a txp category of images. I would need to get : “location/file-name.ext,width,height” from the database, and not sure the easiest/cleanest way to start hashing this out. So I figured I would throw it out first.

<code>var photoArray = new Array( new Array(“images/image1.jpg”, “500”, “331”), new Array(“images/image11.jpg”, “500”, “377”), new Array(“images/image8.jpg”, “490”, “400”) );
</code>

Offline

#2 2006-04-14 21:58:27

Bastian
Plugin Author
From: Wuppertal, Germany
Registered: 2005-02-02
Posts: 376
Website

Re: Get images from a txp category into an array dynamically....Any Ideas?

$photoArray = safe_rows('id, ext,w,h','txp_image','category="a-cat"');

Contains images for a-cat. The path to image you can get by

<pre><code>
for($i=0;$i &#60; count(photoArray );$i++){ extract($photoArray[$i]) $photoArray[$i][‘path’] = hu.$img_dir.’/’.$id.’.’.$ext;
}
</code></pre>

Offline

#3 2006-04-15 16:11:05

soulship
Member
From: Always Sunny Charleston
Registered: 2004-04-30
Posts: 669
Website

Re: Get images from a txp category into an array dynamically....Any Ideas?

Thanks Bastian, I have been looking at the back end of your lightbox to try and dissect it. I am trying to get a version of Moo Show working with a test installation I have. So I will play with your snippet and see what I can hack together.

Thanks!

Offline

Board footer

Powered by FluxBB