close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Image Sizer Redux: using with dynamic image loop

Thread began 8/01/2012 8:52 am by msummers194171 | Last modified 8/01/2012 4:10 pm by Jason Byrnes | 1399 views | 8 replies |

msummers194171

Image Sizer Redux: using with dynamic image loop

I am building a page with a lightbox-type display of images. These images are being loaded dynamically from an array (created from a recordset), allowing new images to be added or exitings ones to be edited/deleted by the client. The relevant code for the loop that places these images on the page is -

<?php foreach ($galleryRecords as $galleryRecord) { ?>
<li><a href="_img/gallery/<?php echo $galleryRecord['filename']; ?>" class="p7lsm_type_img"><img src="_img/gallery/<?php echo $galleryRecord['filename']; ?>" alt="<?php echo $galleryRecord['alt']; ?>" height="240"></a></li>
<?php } ?>

Note that each image is within a list element.

To use Image Resizer with this arrangement, would I just surround this loop with the appropriate resizer markup (taken from a dummy page)? For example, place this BEFORE the start of the loop -

<?php
if(TRUE){ // Begin Cached Resized Image: ImageCacheInstance_1343773049107
ob_start();
?>

and this after the end of it?

<?php
echo(getCachedResizedImageHTML(ob_get_clean(), "_img/scratch/New folder", "proportion", "", false));
} // End Cached Resized Image: ImageCacheInstance_1343773049107
?>

(of course, I'd place the include at the top of the page)

Sign in to reply to this post

Jason ByrnesWebAssist

theres no need to copy code.

You only need to select the image tag in the tag selector, then go to WebAssist -> Image resizer to apply image resizer to the page.

Sign in to reply to this post

msummers194171

So all the code for the Resizer, being within the loop, would be repeated for each image? OK - will try that.

Sign in to reply to this post

msummers194171

Jason - doesn't seem to be working. I can see that the cached images have been created and are located in the designated cache folder, but the src attribute is still pointing to the original (unresized) images.

My code now looks like this -

<?php foreach ($galleryRecords as $galleryRecord) { ?>
<li><a href="_img/gallery/<?php echo $galleryRecord['filename']; ?>" class="p7lsm_type_img">
<?php
if(TRUE){ // Begin Cached Resized Image: ImageCacheInstance_1343838442669
ob_start();
?>
<img src="_img/gallery/<?php echo $galleryRecord['filename']; ?>" alt="<?php echo $galleryRecord['alt']; ?>" height="240">
<?php
echo(getCachedResizedImageHTML(ob_get_clean(), "_img/gallery/cache", "proportion", "", false));
} // End Cached Resized Image: ImageCacheInstance_1343838442669
?>
</a></li>
<?php } ?>

Sign in to reply to this post

Jason ByrnesWebAssist

can you send a link where i can see the problem please.

Sign in to reply to this post

msummers194171

test_solutions-panel-fabrication2.php

The link to trigger the lightshow is at the bottom of the page -

Click to see more panel images

Sign in to reply to this post

msummers194171

OK - I believe that the problem may be due to the lightshow I am using. I can actually see the resizer code on the page but for some reason that is not being picked up by the lightshow scripting. Standby....

Sign in to reply to this post

msummers194171

Yes, that's definitely the problem. Dang. This is not going to work at all since the image tag is only used as a thumbnail while the link to the actual full-sized image (i.e., the one I'd really need to be resized) is taken from the href of the link that contains the image.

Hmmm....

Sign in to reply to this post

Jason ByrnesWebAssist

Yeah, the gallery you are using wont work with Image Resizer because like you say, the full size image is taken from the a href.

Most JQuery and moo tools galleries don't use an a tag and would work, Power Gallery 2 actually uses image resizer to give you control of the image sizes, both thumbnail and large images.

in power gallery 2, you go to the gallery editor and set the size and cropping pattern to use for the thumbs and large images.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...