Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

'On The Fly' Auto Thumbnailer using GD Library 2.1


mloeffen

Recommended Posts

Hello!

 

When I go in on my index.php I get this message:

//// // Output a form radio field function tep_draw_radio_field($name, $value = '', $checked = false, $parameters = '') { return tep_draw_selection_field($name, 'radio', $value, $checked, $parameters); } //// // Output a form textarea field function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) { global $HTTP_GET_VARS, $HTTP_POST_VARS; $field =

 

What could be wrong?

 

This is my htmloutput.php:

 

<?php
/*
$Id: html_output.php,v 1.56 2003/07/09 01:15:48 hpdl Exp $

osCommerce, Open Source E-Commerce Solutions
[url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

Copyright © 2003 osCommerce

Released under the GNU General Public License
*/

////
// The HTML href link wrapper function
function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
 global $request_type, $session_started, $SID;

 if (!tep_not_null($page)) {
  die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>');
 }

 if ($connection == 'NONSSL') {
  $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
 } elseif ($connection == 'SSL') {
  if (ENABLE_SSL == true) {
$link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
  } else {
$link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
  }
 } else {
  die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL</b><br><br>');
 }

 if (tep_not_null($parameters)) {
  $link .= $page . '?' . tep_output_string($parameters);
  $separator = '&';
 } else {
  $link .= $page;
  $separator = '?';
 }

 while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);

// Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined
 if ( ($add_session_id == true) && ($session_started == true) && (SESSION_FORCE_COOKIE_USE == 'False') ) {
  if (tep_not_null($SID)) {
$_sid = $SID;
  } elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == true) ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
 $_sid = tep_session_name() . '=' . tep_session_id();
}
  }
 }

 if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {
  while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);

  $link = str_replace('?', '/', $link);
  $link = str_replace('&', '/', $link);
  $link = str_replace('=', '/', $link);

  $separator = '?';
 }

 if (isset($_sid)) {
  $link .= $separator . tep_output_string($_sid);
 }

 return $link;
}

////
// "On the Fly" Auto Thumbnailer using GD Library, servercaching and browsercaching
// Scales product images dynamically, resulting in smaller file sizes, and keeps
// proper image ratio. Used in conjunction with product_thumb.php t/n generator.
function tep_image($src, $alt = '', $width = '', $height = '', $params = '') { 

// Set default image variable and code
$image = '<img src="' . $src . '"';

// Don't calculate if the image is set to a "%" width
if (strstr($width,'%') == false || strstr($height,'%') == false) { 
 $dont_calculate = 0; 
} else {
 $dont_calculate = 1;  
}

// Dont calculate if a pixel image is being passed (hope you dont have pixels for sale)
if (!strstr($image, 'pixel')) {
 $dont_calculate = 0;
} else {
 $dont_calculate = 1;
} 

// Do we calculate the image size?
if (CONFIG_CALCULATE_IMAGE_SIZE && !$dont_calculate) { 

 // Get the image's information
 if ($image_size = @getimagesize($src)) { 

  $ratio = $image_size[1] / $image_size[0];

  // Set the width and height to the proper ratio
  if (!$width && $height) { 
$ratio = $height / $image_size[1]; 
$width = intval($image_size[0] * $ratio); 
  } elseif ($width && !$height) { 
$ratio = $width / $image_size[0]; 
$height = intval($image_size[1] * $ratio); 
  } elseif (!$width && !$height) { 
$width = $image_size[0]; 
$height = $image_size[1]; 
  } 

  // Scale the image if not the original size
  if ($image_size[0] != $width || $image_size[1] != $height) { 
$rx = $image_size[0] / $width; 
$ry = $image_size[1] / $height; 

if ($rx < $ry) { 
 $width = intval($height / $ratio); 
} else { 
 $height = intval($width * $ratio); 
} 

$image = '<img src="product_thumb.php?img='.$src.'&w='.
tep_output_string($width).'&h='.tep_output_string($height).'"';
  }

 } elseif (IMAGE_REQUIRED == 'false') { 
  return ''; 
 } 
} 

// Add remaining image parameters if they exist
if ($width) { 
 $image .= ' width="' . tep_output_string($width) . '"'; 
} 

if ($height) { 
 $image .= ' height="' . tep_output_string($height) . '"'; 
}   

if (tep_not_null($params)) $image .= ' ' . $params;

$image .= ' border="0" alt="' . tep_output_string($alt) . '"';

if (tep_not_null($alt)) {
 $image .= ' title="' . tep_output_string($alt) . '"';
}

$image .= '>';  

return $image; 
}

/*
// The HTML image wrapper function
function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
 if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
  return false;
 }

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
 $image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';

 if (tep_not_null($alt)) {
  $image .= ' title=" ' . tep_output_string($alt) . ' "';
 }

 if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
  if ($image_size = @getimagesize($src)) {
if (empty($width) && tep_not_null($height)) {
 $ratio = $height / $image_size[1];
 $width = $image_size[0] * $ratio;
} elseif (tep_not_null($width) && empty($height)) {
 $ratio = $width / $image_size[0];
 $height = $image_size[1] * $ratio;
} elseif (empty($width) && empty($height)) {
 $width = $image_size[0];
 $height = $image_size[1];
}
  } elseif (IMAGE_REQUIRED == 'false') {
return false;
  }
 }

 if (tep_not_null($width) && tep_not_null($height)) {
  $image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"';
 }

 if (tep_not_null($parameters)) $image .= ' ' . $parameters;

 $image .= '>';

 return $image;
}
*/
////
// The HTML form submit button wrapper function
// Outputs a button in the selected language
function tep_image_submit($image, $alt = '', $parameters = '') {
 global $language;

 $image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image) . '" border="0" alt="' . tep_output_string($alt) . '"';

 if (tep_not_null($alt)) $image_submit .= ' title=" ' . tep_output_string($alt) . ' "';

 if (tep_not_null($parameters)) $image_submit .= ' ' . $parameters;

 $image_submit .= '>';

 return $image_submit;
}

////
// Output a function button in the selected language
function tep_image_button($image, $alt = '', $parameters = '') {
 global $language;

 return tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image, $alt, '', '', $parameters);
}

////
// Output a separator either through whitespace, or with an image
function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1') {
 return tep_image(DIR_WS_IMAGES . $image, '', $width, $height);
}

////
// Output a form
function tep_draw_form($name, $action, $method = 'post', $parameters = '') {
 $form = '<form name="' . tep_output_string($name) . '" action="' . tep_output_string($action) . '" method="' . tep_output_string($method) . '"';

 if (tep_not_null($parameters)) $form .= ' ' . $parameters;

 $form .= '>';

 return $form;
}

////
// Output a form input field
function tep_draw_input_field($name, $value = '', $parameters = '', $type = 'text', $reinsert_value = true) {
 $field = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';

 if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {
  $field .= ' value="' . tep_output_string(stripslashes($GLOBALS[$name])) . '"';
 } elseif (tep_not_null($value)) {
  $field .= ' value="' . tep_output_string($value) . '"';
 }

 if (tep_not_null($parameters)) $field .= ' ' . $parameters;

 $field .= '>';

 return $field;
}

////
// Output a form password field
function tep_draw_password_field($name, $value = '', $parameters = 'maxlength="40"') {
 return tep_draw_input_field($name, $value, $parameters, 'password', false);
}

////
// Output a selection field - alias function for tep_draw_checkbox_field() and tep_draw_radio_field()
function tep_draw_selection_field($name, $type, $value = '', $checked = false, $parameters = '') {
 $selection = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';

 if (tep_not_null($value)) $selection .= ' value="' . tep_output_string($value) . '"';

 if ( ($checked == true) || ( isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && ( ($GLOBALS[$name] == 'on') || (isset($value) && (stripslashes($GLOBALS[$name]) == $value)) ) ) ) {
  $selection .= ' CHECKED';
 }

 if (tep_not_null($parameters)) $selection .= ' ' . $parameters;

 $selection .= '>';

 return $selection;
}

////
// Output a form checkbox field
function tep_draw_checkbox_field($name, $value = '', $checked = false, $parameters = '') {
 return tep_draw_selection_field($name, 'checkbox', $value, $checked, $parameters);
}

////
// Output a form radio field
function tep_draw_radio_field($name, $value = '', $checked = false, $parameters = '') {
 return tep_draw_selection_field($name, 'radio', $value, $checked, $parameters);
}

////
// Output a form textarea field
function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {
 $field = '<textarea name="' . tep_output_string($name) . '" wrap="' . tep_output_string($wrap) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"';

 if (tep_not_null($parameters)) $field .= ' ' . $parameters;

 $field .= '>';

 if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {
  $field .= tep_output_string_protected(stripslashes($GLOBALS[$name]));
 } elseif (tep_not_null($text)) {
  $field .= tep_output_string_protected($text);
 }

 $field .= '</textarea>';

 return $field;
}

////
// Output a form hidden field
function tep_draw_hidden_field($name, $value = '', $parameters = '') {
 $field = '<input type="hidden" name="' . tep_output_string($name) . '"';

 if (tep_not_null($value)) {
  $field .= ' value="' . tep_output_string($value) . '"';
 } elseif (isset($GLOBALS[$name])) {
  $field .= ' value="' . tep_output_string(stripslashes($GLOBALS[$name])) . '"';
 }

 if (tep_not_null($parameters)) $field .= ' ' . $parameters;

 $field .= '>';

 return $field;
}

////
// Hide form elements
function tep_hide_session_id() {
 global $session_started, $SID;

 if (($session_started == true) && tep_not_null($SID)) {
  return tep_draw_hidden_field(tep_session_name(), tep_session_id());
 }
}

////
// Output a form pull down menu
function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {
 $field = '<select name="' . tep_output_string($name) . '"';

 if (tep_not_null($parameters)) $field .= ' ' . $parameters;

 $field .= '>';

 if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);

 for ($i=0, $n=sizeof($values); $i<$n; $i++) {
  $field .= '<option value="' . tep_output_string($values[$i]['id']) . '"';
  if ($default == $values[$i]['id']) {
$field .= ' SELECTED';
  }

  $field .= '>' . tep_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>';
 }
 $field .= '</select>';

 if ($required == true) $field .= TEXT_FIELD_REQUIRED;

 return $field;
}

////
// Creates a pull-down list of countries
function tep_get_country_list($name, $selected = '', $parameters = '') {
 $countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
 $countries = tep_get_countries();

 for ($i=0, $n=sizeof($countries); $i<$n; $i++) {
  $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);
 }

 return tep_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
}
?>

 

I hope someone could help me..

Edited by dave.hugo
Link to comment
Share on other sites

  • 7 months later...
  • Replies 556
  • Created
  • Last Reply

Top Posters In This Topic

ok well i have installed this contrib. and it is gread except on my product listing page the thumbnails are not showing right at all.

for some reason it is making some random size thumbnail. and puts it in just on that one page. all of my other thumbs are working ok.

i have been trying to sort this problem myself but am not getting anywhere. if i change the html_output file in catalog side the picture on my product listing page goes to almost full size but i cannot figure out where it is doing it. Thanks in advance for any help

Link to comment
Share on other sites

  • 4 months later...

got this up and running, but some of my images which have very small category images are being displayed with black borders

 

see this page for an example: http://www.outdoorbits.com/fiamma-tie-down-kit-p-38.html

 

It is caused by the thumbnailer increasing the size of the image to the standard size and filling the extra stretched space with black colour.

 

My Question is how do i change the filled space to be white instead of black ?

Link to comment
Share on other sites

  • 1 month later...

I posted a cry for help on another auto thumbnailer thread but wasn't sure if that was the right one.

 

The contribution is fab the thumbnails look great and works well. My problem is that when in the admin area all the buttons for 'add new product' 'add category' delete product etc are missing and cannot edit add move anything.

 

if someone can please help me that would be great.

 

Thanks in advance.

 

Timmer

Link to comment
Share on other sites

  • 3 months later...

The problem happens when image is not loaded using regular way via admin add new product but when you upload products in bulk using CSV loader.

Images like 123+3+3.jpg will not showed as thumbnail. The regular 123+3+3.jpg image exists and when you click on thumbnail it will pop up. Looks like the problem appears only when pluses are in the file name. All other pictures seems to be shown correctly. If you go than and reload the image using admin edit product function, the thumbnail appears.

 

Anybody know how to fix the problem? Please help as now many of my thumbnail pictures with pluses are not shown :(

Link to comment
Share on other sites

  • 3 months later...

Hi there

 

Have installed 2.4 on oscommerce 2.3.1 and mostly seems to be working but the products page doesnt seem to work as thunmbnail, i have seen comments on editing products_info.php direct but these are directed for use of 2 images rather than on the fly thumbnailer, does anybody know what the fix is

 

i belive the code refred to is

 

<script type="text/javascript">
$('#piGal ul').bxGallery({
 maxwidth: 80,
 maxheight: 100,
 thumbwidth: <?php echo (($pi_counter > 1) ? '75' : '0'); ?>,
 thumbcontainer: 100,
 load_image: 'ext/jquery/bxGallery/spinner.gif'
});
</script>

 

any assistance would be appriciated

 

thank you

 

David

David

Link to comment
Share on other sites

  • 1 month later...

Great contrib! If anyone using an admin-configurable version has to change the configuration_group_id from 100 in the SQL file don't forget (as I did) to change it in the query at line 21 in catalog/product_thumb.php or you'll get an arty-farty cubist thumbnail image compressed right down to zero quality. On the plus side, you get a nice quick download with a file size of under 1KB :-"

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

I installed this great product a few years ago, not sure which version i have but can cache images, and have thumbnails/ dir

 

I have it istalled on a multi store set up with 1 images folder on the 1st store and the other stores get there images from that main store images folder

 

All has been working great for a number of years but last week moved all the sites onto a new faster server, everything in main store is working as it should but the other stores are not, i know the shared images folder is working ok as its getting some images direct like header images that go direct to images folder. Unfortunatlty the product images will not.

 

if i force images required in Admin configuration/images image required = false then it will download the full version of the product image, ie one that is not the thumbnail and none of the category images, if i switch off image required it will not download the product image

 

have messed about with configure.php but not got anywhere, i guess its going to be something minor with the path but i have come back to this 3 or 4 times now not sussed it yet, anypointers would be appriciated

 

thank you

 

David

David

Link to comment
Share on other sites

I am slowly making headway, did have a couple of path issues which i think have now been eradicated, it is very strange as it was all working fine on the last server

 

in product_info.php i get

 


document.write('<a href="javascript:popupWindow(\'http://www.domain.co.uk/popup_image.php?pID=20501\')"><br>Click to enlarge</a>'); 

//--></script> <noscript> <a href="http://www.domain.co.uk/images/CS-P240CL.jpg" target="_blank"><br>Click to enlarge</a></noscript> <TR><td align="center" class="main"><input type="hidden" name="products_id" 

 

but should get something like (which is what i get on main site (they are different products )

 


document.write('<a href="javascript:popupWindow(\'http://www.domain.com/ajustable-shower-head-rose-pi-3648.html\')"><img src="product_thumb.php?img=images/Showerheadmassagebig.jpg&w=100&h=80" width="100" height="80" border="0" alt="Ajustable Shower head (rose)" title="Ajustable Shower head (rose)"><br>Click to enlarge</a>'); 

//--></script> <noscript> <a href="http://www.domain.com/images/Showerheadmassagebig.jpg" target="_blank"><img src="product_thumb.php?img=images/Showerheadmassagebig.jpg&w=100&h=80" width="100" height="80" border="0" alt="Ajustable Shower head (rose)" title="Ajustable Shower head (rose)"><

 

I have ensured that products_thumb.php and the includes/function/html_output.html wrapper is the same (i think)

 

any pointers about where to look next would be appriciated

 

thank you

David

Link to comment
Share on other sites

  • 4 weeks later...

hello everyone,

I have CPU consuming problem with this addon.

 

OSC: 2.2RC2

Addon: otf_autoThumb_v2-4fix3

Server: 2x Intel® Core2 Duo CPU E6550 @ 2.33GHz

 

These days my website has daily 3000-5000 visitors, comonly 150-300 visitors online at the same time.

I received email from hosting company, it said the cpu has been maxed out.

They and me both find that the CPU big consuming is product_thumb.php

 

I don't know why this addon consume so much CPU, have any way to optimize it?

Need help!!!

Link to comment
Share on other sites

  • 2 weeks later...

Hello,

 

I have a error log problem and one of the main problems is this

PHP Notice: Undefined variable: filename in /var/www/vhosts/***/product_thumb.php on line 276

PHP Notice: Undefined variable: filename in /var/www/vhosts/***/product_thumb.php on line 327

 

The lines 276 and 327 are:

276 if (file_exists($filename) && $tn_server_cache && filemtime($filename) > filemtime($_GET['img'])
327 $tmp_path = str_replace(basename($filename), '', $filename);

 

Both for cache and someone told me a few weeks ago the generated thumbnail whas not recalled even when it whas a old image that was looked up a lot more times.

 

Please help me out

 

Regards,

 

jasper

Link to comment
Share on other sites

Recently I replaced my old, heavily modified Mile Stone 2 store with 2.3.1. I wanted some of the same contributions that I had installed 4-5 years ago. I installed 'On The Fly' Auto Thumbnailer and my thumbnails wouldn't display. I just saw the alt text as a link and the product title as a link. The thing that fixed my trouble was replacing the code in catalog/product_thumb.php with the code in this post:

http://www.oscommerce.com/forums/index.php?showtopic=285510&st=0&gopid=1188192&

 

I also found problems in my catalog\includes\functions\html_output.php because my html editor turned two & into & and | into |, which is a pipe, or vertical bar.

 

It was interesting to see my HTML editor screwing up, but fixing html_output.php with notepad still didn't display my thumbnails, the code in the link did.

 

Danny

If I'm giving advice, it is based on what path I would take to fix your problem. My path may be wrong.

Link to comment
Share on other sites

  • 2 months later...
  • 3 months later...

I have used this contrib in a few stores and it worked flawlessly. A clients server just upgraded the php software so I did an update to fix some errors and assumed it would fix the thumbs, but it didn't.

 

My thumbs are not generating, I do not get any errors, and when I view the image the path is correct(http://www.duds4buds.com/product_thumb.php?img=images/Golden-bears_GH.jpg&w=110&h=71) but I just get a path in the browser window instead of a image.

 

I hope someone can shed some light on my problem,

Todd

Link to comment
Share on other sites

I have done a re-write around this, partly as some of the code is bugged but also its very slow on shared servers with processor limits as it requires a new dBase connection for every image.

 

If there's enough interest I could create a new add-on around that, it would not have all the features of this though.

 

Given the issues with this I`m not sure its worth de-bugging

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Do you know what the issues are off hand? I am not really worried about speed, right now, I just need to get the images working. Is it to do with the upgrade to php 5.3.x?

 

I also found that the thumbs are being generated just not shown.

 

Thank you for your time,

Todd

Link to comment
Share on other sites

Sorry, it was some time ago I don't remember exactly what, but yes some were to do with display. I ended up scrapping the original and wrote new code.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

I also now remember I had an issue with it on the same shop a number of month's ago and was able to fix it. I was unable/unwilling to find the problem this morning and scrapped the contrib. For anyone that views this in the future what (if any) contrib do you recommend for thumbnailing?

 

Todd

Link to comment
Share on other sites

This one works ok...but dont use the TimThumb version....

 

You can for instance use this version: DJStealth 7 Sep 2008

 

And update the thumbfile with this one: mauriziomagnino 11 Feb 2011

Edited by toyicebear
Link to comment
Share on other sites

I installed v3 for osc 2.3.1

Strangely, the line

if (!is_file($src)) { $src = "../images/no_image.jpg"; }

at html_output.php, under catalog/admin/includes/functions, made all my products images

disappear. Removing this line the images comes back.

 

The banner on the left top is intacted.

 

This means the test for $src is not a file. Why?

 

My programs are shown

 

http://pastebin.com/JY98xfqk (html_output.php)

 

http://pastebin.com/PLTM9KuV (categories.php)

Link to comment
Share on other sites

  • 2 weeks later...

I'm using otfAutoThumb-v3.0-for-2.3.1 http://addons.oscommerce.com/info/8104 (nobodyfamous 27 Jul 2011)

 

 

I made some modification to product_thumb.php :

  • block '..' in paths,
  • lock users into the DIR_WS_IMAGES folder,
  • make variable names clearer,
  • simpler modify_tn_path,
  • remove unneeded calls to modify_tn_path()

The end result can be used on both the catalog and the admin side w/o change.

 

Source: product_thumb.php

 

This change might be needed on the admin includes/functions/html_output.php:

inside tep_image()

 

change

// Get the image's information
if ($image_size = @getimagesize($src)) {

to

$FS_img = $src;
if (!is_readable($FS_img))
$FS_img = DIR_FS_CATALOG . $FS_img;
// Get the image's information
if ($image_size = @getimagesize($FS_img)) {

 

Feedback/advice on my changes would be very welcome.

 

cheers.

 

 

One reservation: My test environment currently has '/' as catalog ( define('DIR_WS_HTTP_CATALOG', '/') )

so this may need some minor tuning to work for other locations, however I *think* it should work as-is. Please let me know either way? ;)

 

possible further improvements: As @@spooks has said a db connection per thumbnail may be a bit of a problem... in that case just pull the config out of the db and into the php. (but the store admin would no longer be able to change thumbnail settings from the admin interface.)

Edited by mpalasis
Link to comment
Share on other sites

+ modification:

  • if thumbnails folder is specified, then a directory structure will be automatically created inside it to reflect the source image. (ie img=images/foo/bar/image.jpg .. thumbnails/images/foo/bar/image.jpg_thumb123x456.jpg...). This effect did not quite work, though the docs of the addon said it would...

Edited by mpalasis
Link to comment
Share on other sites

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...