Giter Club home page Giter Club logo

wordpress-timthumb-alternative's People

Contributors

matthewruddy avatar sleeplessbyte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wordpress-timthumb-alternative's Issues

Creating A Function to get Featured image

Hi!

I know php and developing Wordpress themes fairly well ( but still consider myself a n00b) and am having trouble creating a function to use with this alternative for featured images. I am trying to pass the wp_get_attachment_image_src( ) call using this :

function tpp_custom_img( $thumb_size, $image_width, $image_height ) {

global $post;

$params = array( 'width' => $image_width, 'height' => $image_height );

$url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID, '' ), $thumb_size );
$custom_img_src = matthewruddy_image_resize( $url[0], $params );

return $custom_img_src;

}

But it is not working. please help.

Using retina images

Using a script like retinajs assumes that the filename of the retina image should have a suffix @2x as described in Apple's documentation, and not simply double the resolution in the filename.
So if we have an image called image.png and we upload it creating a thumbnail with dimentions 300x120, the resulting image files should be like this:
image-300x120.png (normal version)
[email protected] (retina version)
Instead, they are like this:
image-300x120.png (normal version)
image-600x240.png (retina version)

HOW do you use images named like this for retina screens?

Script Bails if Subdomain is/isn't Present (www vs non-www)

This seems to be expected behavior of the script because WordPress treats this situation as if the images are external.

My situation occurred because the initial WordPress install took place under a non-www domain. After migrating the site, it was changed to the www version which caused the script to fail. In the browser, the images still appeared with the www prepended, but in the database they were not.

I don't think this requires a patch, although I think it could use an extra error handling statement somewhere. At the very least you might want to mention the issue in the documentation.

Delete thumbnails on media library delete?

Hey, this looks like a promising script. Just wondering what happens when the main image is deleted from the media library - are the thumbnails removed as well? I've found with VTResize that old thumbnails stick around and sometimes become associated with new images with the same filename.

just returns original image?

$url = $job->getLogoUrl() ;   // Required
$width = 100;                                                                  // Optional. Defaults to '150'
$height = 50;                                                                 // Optional. Defaults to '150'
$crop = true;                                                                  // Optional. Defaults to 'true'
$retina = false;                                                               // Optional. Defaults to 'false'

// Call the resizing function (returns an array)
$image = matthewruddy_image_resize( $url, $width, $height, $crop, $retina );
if ( is_wp_error( $image ) ) {
    echo $image->get_error_message() ;       // Displays error message returned from resizing function
 } else {
   $img = $image['url'];
   echo "<img src='$img' alt='Logo' />";
  }

Setting crop to false squashes/stretches images instead of the desired resize result

If I pass an image through this script with crop set to false, instead of simply resizing the image, it nastily stretches/squashes the image into the specified width/height.

Example: original image is 100x500.

I want the script to take the values width:50, height:50, crop:false and return me an image that's 10x50. What is actually does is returns that portrait image squashed into a 50x50 space.

Width/Height being overridden

Hi, thanks for the great script.

Maybe I'm wrong but near the top of matthewruddy_image_resize() for WP 3.5+ you've got:

$width = ( $width ) ? get_option( 'thumbnail_size_w' ) : $width;
$height = ( $height ) ? get_option( 'thumbnail_size_h' ) : $height;

Isn't this backwards? Shouldn't it use get_option when $width/$height are NOT set? Something like:

$width = ( !isset($width) ) ? get_option( 'thumbnail_size_w' ) : $width;
$height = ( !isset($height) ) ? get_option( 'thumbnail_size_h' ) : $height;

Also I've got to declare global $wp_version; to get into this function.

Line 45/46 & 178/179 causing fatal error

Love the script - was working perfect on my localhost, then I uploaded to my server and was given a fatal error because of these four lines.

$width = $width ?: get_option( 'thumbnail_size_w' );
$height = $height ?: get_option( 'thumbnail_size_h' );

Seems the server didn't like the ?: syntax.

I commented these lines out for now and the script still works.

Any idea why this would happen?

Thanks!

Installation

Sorry to ask such a n00b question but I need help installing/using this script. I am using the Good Idea wordpress theme (http://themes.goodlayers.com/goodidea/) and the thumbnails on the home page are not loading the retina versions because timthumb is resizing them. I would really like to just disable timthumb altogether but am having a hard time making that happen so in further searching I stumbled upon this script and it sounds like this can do what I need it to do... correct? If so, can you provide a little more clear instructions on how to install/implement in my current situation?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.