freshizer - Custom WordPress Image Resizer with Cache

freshface said
FlickapixDezign said

how about crop, crop postion & zoom? any vulnerablilities?

1.) cropping and zooming will be in one of the next releases

2.) it’s 100% secure:)

Awesome :slight_smile: im developing a premium wp theme for release here in a month or two so may consider inclusion after some testing and comparison with other scripts currently emerging :slight_smile:

CyberShot said

so how exactly does this work? I don’t see any documentation in the download. Does it prevent wordpress from changing any images?

it resize images through the WP functions and store them in the directory, listed in the first post. It also create a unique hash for every image, so you can be sure that there will be no collision. And it clear the resized images every 7 days, so you can have always the fresh one :slight_smile:

nice work

This won’t work on multisite - check your getRelativePath() function.

Also, since you rely on getimagesize() function to verify the images, it would be imperative to add a @ to it.

Another thing, hashing could be made more unique, although i’m not sure what it does exactly? I thought when you mentioned about it on the Aqua Resizer thread you were referring to hashing the cropped image instead of the original image?

Oh, and running through the whole fresh dir to check for expired images for every instance of image resizing is not really a good idea. You could probably make the check to be separate from the class, and instantiated at a scheduled period, if you ever want to go that route at all.

Cheers :slight_smile:

I’m getting an error that gives me the following:
Image : http://location-of-my-image/image.jpg does not exists !

It is showing the correct image url in the error…but telling me the image doesn’t exist.

Any ideas?

Hi,

after doing some deeper testings I can recommend this script without any restrictions. Easy to implement, very fast Image scaling (did a re size for about 40 large scales images 1920x1080 down to 45x45 which takes a heartbeat to complete).

Again great work!

Best Regards
UnitedThemes

I’m anxious to give this script a try, but it looks like it’s not working on Multisite. As soon as that’s fixed I’ll commit to it. :slight_smile:

Any plans for future update with the script? I really love your work, hope it stays free. I’m going to test this on an actual server right now i’m testing it locally hope it wont cause any problems. I’ll give my thoughts on how it goes later.

After testing, found out that it won’t work with multisite, it seems that it can’t create the dir called freshizer, but instead it created the folder in wp-content/blogs.dir/2/files/freshizer so when i fetched the url of the image it returned nothing cause the file was stored in a different dir.

But it works perfectly with the regular wordpress installation, few questions that’s been bothering me since the wordpress’s function add_image_size creates a copy of the image in a different size what difference does it make if this script also does the same thing except it stores the image in the folder freshizer, i thought those images were created temporarily then later automatically deleted after a certain time like timthumb does.

hope you continue its development.

Hi guys!

thank you for your interest. I will fix the multisite bug when I will have a time :slight_smile: Anyway I’m now heading to final exams at my university, so I will not be available about a week or so :slight_smile:

cheers, freshface

Hi guys!

thank you for your interest. I will fix the multisite bug when I will have a time :slight_smile: Anyway I’m now heading to final exams at my university, so I will not be available about a week or so :slight_smile:

cheers, freshface

Multisite compatibility is a must.

final exams at my university
Good luck. :)

New version added( 1.1 ) .

This version is wordpress independent, so you can use it in your HTML demo previews.

Still missing:

1.) resizing images to be bigger than the original

2.) WP Multi Site testing

cheers, freshface

VERSION 1.2

Features:

  • - completely independent at WordPress
  • - allowed to zoom images
  • - correct cropping

Bugs:

  • - when you are using WPMU and use /wordpress/something/something/ structure, it won't work, minor bug

Testing:

  • - we just added it to all our demo servers. Is there some volunteer who can help us to test this script ?

LINK

https://github.com/boobslover/freshizer

Hi,

will start testing soon and get back to you then :slight_smile:

Cheers
UT

freshface said

VERSION 1.2

Features:

  • - completely independent at WordPress
  • - allowed to zoom images
  • - correct cropping

Bugs:

  • - when you are using WPMU and use /wordpress/something/something/ structure, it won't work, minor bug

Testing:

  • - we just added it to all our demo servers. Is there some volunteer who can help us to test this script ?

LINK

https://github.com/boobslover/freshizer

Hi,

regarding the MU bug, if the problem is to retrive the real url of the files i do something like this on the file path that WP returns:

global $blog_id;
//$url = image url returned by WP
	
	if (is_multisite() && isset($blog_id) && $blog_id > 0) {
		
		$url = explode('/files/', $url);
		
		if (isset($url[1])) {
			
			$url = '/blogs.dir/' . $blog_id . '/files/' . $url[1];
			
		}
		
	}

Now i didn’t look into your code, so not sure how you should implement this, but I guess this might help.

Kudos for your work :wink:

Parker

Looks great!

Could you please explain how to use this in the Loop to display a post’s featured image?

Cheers!

Simon

ParkerAndKent said
freshface said

VERSION 1.2

Features:

  • - completely independent at WordPress
  • - allowed to zoom images
  • - correct cropping

Bugs:

  • - when you are using WPMU and use /wordpress/something/something/ structure, it won't work, minor bug

Testing:

  • - we just added it to all our demo servers. Is there some volunteer who can help us to test this script ?

LINK

https://github.com/boobslover/freshizer

Hi,

regarding the MU bug, if the problem is to retrive the real url of the files i do something like this on the file path that WP returns:

global $blog_id;
//$url = image url returned by WP
	
	if (is_multisite() && isset($blog_id) && $blog_id > 0) {
		
		$url = explode('/files/', $url);
		
		if (isset($url[1])) {
			
			$url = '/blogs.dir/' . $blog_id . '/files/' . $url[1];
			
		}
		
	}

Now i didn’t look into your code, so not sure how you should implement this, but I guess this might help.

Kudos for your work :wink:

Parker

Ahh, I didnt know that “is_multisite()” function exists :slight_smile: Anyway the final problem is, that I need to retrieve the original wordpress path, explanation

localhost/wp/ -> ORIGINAL
localhost/wp/aaa/bbb -> MU1
localhost/wp/bbb/ccc -> MU2

could you please tell me how to do it ? :slight_smile: get_bloginfo(‘wpurl’); returns the MU, and I need the original for correctly build url of the image :slight_smile:

Why do you need the original blog URL to build the images?

In sub blogs the images are stored in a different folder, not within the main blog uploads, that’s why I do this:

$url = '/blogs.dir/' . $blog_id . '/files/' . $url[1];

Additionally this url is safe, because it baypasses any rewrite rule on server.

The only thing I’m not sure about, is what happens when sub blogs are not in sub folders, but in sub domains… it should work, because I think that when you select sub domains for blogs the only thing that changes is the rewrite rule in the .htaccess file, so the files are always in the same folders.

I used this system with timthumb and it worked…

To make it clearer, this is how I use my functions to use timthumb with mu installation:

This function builds the image URL, if is a sub blog it changes the URL to the correct one, otherwise if it’s the main blog ($blog_id == 0) it doesn’t do anything.

function pk_build_image($url = '', $width = 0, $height = 0, $zc = 1, $amp = '&') {
	
	if ($url == '') {
		
		return '';	
		
	}
	
	global $blog_id;
	
	if (is_multisite() && isset($blog_id) && $blog_id > 0) {
		
		$url = explode('/files/', $url);
		
		if (isset($url[1])) {
			
			$url = '/blogs.dir/' . $blog_id . '/files/' . $url[1];
			
		}
		
	}
	
	$final_image_path = '';
	
	$width_string = ($width <= 0 || $width == '') ? '' : $amp.'w='.$width;
	$height_string = ($height <= 0 || $height == '') ? '' : $amp.'h='.$height;
	$zc_string = ($width_string == '' && $height_string == '') ? '' : $amp.'zc='.$zc;
	
	if ($zc_string == '') {
		
		return esc_url($url);
		
	}
	
	$final_image_path = PK_THEME_DIR.'/timthumb/timthumb.php?src='.$url.$width_string.$height_string.$zc_string;
	
	return esc_url($final_image_path);
	
}

How I use this function:

<?php
$image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full')
?>

Let me know :wink: