Welcome, Guest
Username Password: Remember me

Small code implementation for image rescaling
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Small code implementation for image rescaling

Small code implementation for image rescaling 14 years, 2 months ago #468

  • customhost
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Karma: 0
Hi guys,

I kindly ask you to implement the following piece of code in the next release of MobileJoomla.

Before lines 181-182 in imagerescaler.class.php:
if(file_exists($dest_imagepath))
return $dest_imageuri;


Please add the following:
if(substr($dest_imageuri,0,2) == '//')
$dest_imageuri = substr($dest_imageuri,1);


The sense behind this check is that on an IIS webserver, if an image source starts with 2 double slashes (e.g. "//images/stories/Resized/image.gif" instead of "/images/stories/Resized/image.gif"), the rescaled image is not displayed. The above code takes care of this issue and reforms the URL if necessary.

Cheers,
Eric

Small code implementation for image rescaling 14 years, 2 months ago #2233

  • miohtama
  • OFFLINE
  • Expert Boarder
  • Posts: 112
  • Karma: 4
OK - we'll merge this with trunk.

Ps. Source code is now at Github so we can accept contributions through that way also. See the recent blog post.

Small code implementation for image rescaling 13 years, 12 months ago #2661

  • jerms
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Karma: 0
Hello,

is it possible to make this instruction compatible with PHP5.1 :
$src_imagename = pathinfo($imageurl, PATHINFO_FILENAME);


I needed to create a function to verifiy if the constant "PATHINFO_FILENAME" is defined, because my provider only has PHP5.1, and this was implemented in 5.2
  function pathinfo_filename($file)  {
if (defined('PATHINFO_FILENAME')) return pathinfo($file,PATHINFO_FILENAME);
if (strstr($file, '.')) return substr($file,0,strrpos($file,'.'));
}
 


$src_imagename = ImageRescaler::pathinfo_filename($imageurl);


thanks,
Jerm's

Small code implementation for image rescaling 13 years, 12 months ago #2662

  • dryabov
  • OFFLINE
  • Administrator
  • Denis Ryabov, Lead Developer
  • Posts: 4867
  • Karma: 105
jerms, thanks a lot!
  • Page:
  • 1
Time to create page: 0.26 seconds

By continuing to use this site you consent to the use of cookies on your device as described in our cookie policy unless you have disabled them. This site will not function correctly without cookies.

I accept cookies from this site.