Jump to content


Photo

parse gallery_resize width and height


Below I paste a part of public function inlineResize( $tag, $width, $height ) in admin/applications_addon/ips/gallery/sources/classes/gallery.php

  /* Quickly resize */
  if ( strstr( $tag, "width='" ) )
  {
   $tag = preg_replace( "#width='([^']+?)'#", "width='" . $width . "'", $tag );
  }
 
  if ( strstr( $tag, "height='" ) )
  {
   $tag = preg_replace( "#height='([^']+?)'#", "height='" . $width . "'", $tag );
  }
 
  if ( strstr( $tag, "cover_img___xx___") )
  {
   $tag = str_ireplace( "cover_img___xx___", "cover_img_" . $width, $tag );
  }
   
  return $tag;

Well, there are two bugs in this piece of code:

1: $tag = preg_replace( "#height='([^']+?)'#", "height='" . $width . "'", $tag ); should obviously be $height.

2. In both if statements, you forgot to include the else parts... So, in the case width and height tags are not included in the original imagetag, the function doesn't actually add a pair of dimensions for it.

I'm not sure where I have to fill in the version of Gallery this report applies to, so let me mention I'm talking about IP.Gallery v4.1.1

Status: Fixed
Version: 4.1.0
Fixed In: 5.0.0 Beta 1


4 Comments

Seems like Brandon responded to this today, but I can't see the response. What's wrong?!?!??!?
There is a problem with tracker and you can't see the status change:

Posted Image
TeraByte,

Looks like Tracker has old problem again...
We do not see those lines that you just put a screen shot....

Some how we do not see confirmed or other kind in-line information on tracker...
We know, permissions just get randomly wiped out on tracker from time to time. It will be fixed in due course.