Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.

Public Report
Report From: Delphi for PHP/Library    [ Add a report in this area ]  
Report #:  114892   Status: Open
Image component doesn't obey formatting properties
Project:  HTML5 Builder Build #:  5.1.167.137
Version:    5.0 Submitted By:   Kevin Day
Report Type:  Basic functionality failure Date Reported:  4/11/2013 10:39:21 PM
Severity:    Serious / Highly visible problem Last Updated: 4/11/2013 11:03:39 PM
Platform:    All platforms Internal Tracking #:   5003
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
Image component doesn't obey formatting properties

No matter what property values you set, an image format won't change.

Please see [Steps] and [Workaround] of QC for more details.
Steps to Reproduce:
1. On a server page, place an image
2. Set the source.
3. Unless the ImageSource starts with a "." or a "..",  the properties of center, proportional etc... won't work.
Workarounds
The propblem is in Image::getImageSourcePath() in extctrls.inc.php.  The writer of this component has forgotten that the image source property is a URL and often will need the document root prepended to it even if it is absolute or then the script file if it isn't.

The fix is to change from
============
  private function getImageSourcePath()
  {
  // check if relative
  if(substr($this->_imagesource, 0, 2) == ".." || $this->_imagesource{0} == ".")
  {
  return dirname($_SERVER['SCRIPT_FILENAME']) . '/' . $this->_imagesource;
  }
  else
  return  $this->_imagesource;
  }
============
to
============
  private function getImageSourcePath()
  {
    $f = $this->_imagesource;
    // check if relative
    if(($this->_imagesource{0} == "/") || ($this->_imagesource{0} == "\\"))
    {
      $dr = $_SERVER['DOCUMENT_ROOT'];
      $dr = rtrim($dr, "/\\");
      $f = $dr . $this->_imagesource;
    }
    else
      $f = dirname($_SERVER['SCRIPT_FILENAME']) . '/' . $this->_imagesource;

    return is_file($f)? $f: $this->_imagesource;
  }
============
Attachment
None
Comments

None

Server Response from: ETNACODE01