Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

job_manager_get_resized_image Loading Incorrect File #706

Closed
spencerfinnell opened this issue Jun 28, 2016 · 2 comments · Fixed by #775
Closed

job_manager_get_resized_image Loading Incorrect File #706

spencerfinnell opened this issue Jun 28, 2016 · 2 comments · Fixed by #775

Comments

@spencerfinnell
Copy link
Contributor

spencerfinnell commented Jun 28, 2016

What I Expected To Happen

Use job_manager_get_resized_image( 'http://image.com/image.jpg', 'thumbnail' ); and get http://image.com/image-150x150.jpg returned.

What Happened Instead

http://image.com/image-thumbnail.jpg is generated and returned instead of the already existing http://image.com/image-150x150.jpg

Steps to Reproduce the Bug

Call job_manager_get_resized_image( 'http://image.com/image.jpg', 'thumbnail' );

Suggested Fix

$resized_logo_path = str_replace( '.' . $path_parts['extension'], '-' . $size . '.' . $path_parts['extension'], $logo_path );

Should not look for $size directly but instead the combined $img_width and $img_height that are declared above.

$dims = $img_width . 'x' . $img_height;
$resized_logo_path = str_replace( '.' . $path_parts['extension'], '-' . $dims . '.' . $path_parts['extension'], $logo_path );
@donnchawp
Copy link
Contributor

It looks like job_manager_get_resized_image() is only used when the company logo is stored in postmeta, from pre-1.24.0 so those would be old entries but your fix works in my testing. I'll submit a PR shortly.

@spencerfinnell
Copy link
Contributor Author

Cool thanks! Also happens for custom File fields which are are stored in meta still.

donnchawp added a commit that referenced this issue Oct 6, 2016
Fixes #706

The function job_manager_get_resized_image() creates images that
use the strings, 'thumbnail', 'medium', 'large' rather than the
dimensions that WordPress uses. This fixes that and the plugin
will use files that might already have been generated by
WordPress. Props @spencerfinnell.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants