close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Resizer not working with SEO frindly URL's

Thread began 5/26/2012 8:47 pm by neo314 | Last modified 8/05/2012 12:52 pm by Ian S | 2567 views | 5 replies |

neo314

Resizer not working with SEO frindly URL's

I am trying to use SEO friendly url's in this program, but I am finding Image Resizer has a problem with that. I'm using mod_rewrite. The rewrite code is not interfering the correct values for PHP_SELF, DOCUMENT_ROOT, etc.

The test url is:

http://mydomain.com/blog/post/this/

post and this are part of the rewrite, so it becomes

blog.php?qs=post/this

The code looks like this:

<?php
if(TRUE){ // Begin Cached Resized Image: ImageCacheInstance_1337410240488
ob_start();
?>
<img src="../../images/blogs/<?php echo $row_blogPosts['image']; ?>" alt="<?php echo $row_blogPosts['image_alt']; ?>" width="160" height="120" />
<?php
echo(getCachedResizedImageHTML(ob_get_clean(), "../../image_cache", "fit", "#EEEEEE", true));
} // End Cached Resized Image: ImageCacheInstance_1337410240488
?>

I have tried messing around with the second parameter of getCachedResizedImageHTML, but the existing version is correct and the resized images are created as necessary.

The problem is the link url is coming out like this:

src="image_cache/images/blogs/fit/bird_w160_h120/bird_05200200.jpg"



Changing the image reference to:

<img src="/images/blogs/<?php echo $row_blogPosts['image'];  ?>" alt="<?php echo $row_blogPosts['image_alt']; ?>"  width="160" height="120" />


does not seem to help. It should recognize site root relative links.

Sign in to reply to this post

neo314

I did find where the problem lies. I would suggest that the code detect when the image has a site root relative link (e.g. /image/picture.jpg) and account for that both in the thumbnail creation and in the src code that is put out in the new image.

I can rewrite the code in CachedResize_Image.php to fix it, but your solution may be different and the GUI wouldn't work for me anymore, so for now, I'll use javascript to deal with it.

I suggest either it automatically detects site root relative links, or there is a checkbox in the GUI for forcing a site root relative link. The former would be a better solution as the creation of thumbnails should be possible with a site root relative link as well.

Thanx
Steven

Sign in to reply to this post

Jason ByrnesWebAssist

I have forwarded this to our engineering team so they can look into the possibility of adding a Site Relative option.

Sign in to reply to this post

Christopher WestCommunity Expert

@Steven, could I ask you what HTACCESS code you are using for SEO friendly URLS? The reason why I ask is that I have gone to many links on googles for the same thing, but the code never seems to work for me when i enter it in a .HTACCESS file. I have even tried uploading the file in either binary AND ASCII but no matter which i select the code i use still dont work. about the only .HTACCESS code that does work for me is some webpage redirection code in a past project.

regards

Chris

Sign in to reply to this post

neo314

designerwest sent you a friend request so we could pm.

Thanks Jason.

In the meantime, if it helps anyone else, I have implemented javascript with jQuery to work around the issue.

The serverside code remains a relative link so the extension works. The images to modify need to be found by a selector (class, id, images within a specific container, or just all image tags if you are resizing all of them. The code checks the src of each of thos image tags and adds a / at the beginning if it is not already the first character.

$().ready(function() {
// Fix for non-site root relative links with WA Image Resize.
if ($(".postItemPic img").length) {
$(".postItemPic img").each(function() {
if ($(this).attr("src").indexOf("/") != 0) {
$(this).attr("src","/"+$(this).attr("src"));
}
});
}
});
Sign in to reply to this post

Ian S

Hi Guys,

Thanks for this thread. It's helped me out a bit this evening in getting the image resizer working on SEO friendly URLs.

I am getting a speed issue though with this fix. I have a list of thumbnails of products in a horizontal looper, and the image resizer is very slow. I have used it on a standard URL before (i.e. products.php rather than /products/) and Image Resizer seems pretty quick so I'm guessing that its the javascript that is slowing things down as each record gets written to the page.

Are there any plans to get Image Resizer working with rewritten URLs anytime soon?

Cheers
Ian

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...