function getImagesNeedCreateThumb($objImage) { $objImage->image_big = urldecode($objImage->image_big); $imagesTable = JTable::getInstance('images', 'Table'); $imagesTable->load((int) $objImage->image_id); $realPath = JPATH_ROOT . DS . str_replace('/', DS, urldecode($imagesTable->image_big)); $thumbPath = JPATH_ROOT . DS . str_replace('/', DS, urldecode($imagesTable->image_small)); $arrayThumb[] = $thumbPath; // check real image exists if (JFile::exists($realPath)) { $imageSize = @filesize($realPath); // check real image have changed if ($imageSize > 0 && $imageSize != $imagesTable->image_size) { //if real image have changed , check thumb exists and remove if (JFile::exists($thumbPath)) { return $imagesTable->image_id; } } else { if ($imageSize > 0 && $imageSize == $imagesTable->image_size) { if (!JFile::exists($thumbPath)) { return $imagesTable->image_id; } } } } else { if (JFile::exists($thumbPath)) { JSNISImageThumbNail::deleteThumbImage($arrayThumb); } } }
function checkImageFolderStatus($objImage) { $imagesTable =& JTable::getInstance('images', 'Table'); $imagesTable->load((int) $objImage->image_id); $realPath = JPATH_ROOT . DS . $objImage->image_big; $imageSize = @filesize($realPath); $thumbName = explode(DS, str_replace('/', DS, $imagesTable->image_small)); $thumbName = end($thumbName); $folderThumb = JPATH_ROOT . DS . 'images' . DS . 'jsn_is_thumbs' . DS; $thumbPath = $folderThumb . $thumbName; $arrayThumb[] = $imagesTable->image_small; // check real image exists if (JFile::exists($realPath)) { // check real image have changed if ($imageSize > 0 && $imageSize != $imagesTable->image_size) { //if real image have changed , check thumb exists and remove if (JFile::exists($folderThumb . $thumbName)) { JSNISImageThumbNail::deleteThumbImage($arrayThumb); } // create thumb for real image which have changed $imageThumbPath = $this->createThumbImageFolder($objImage); // save new information $imagesTable->image_medium = $imageThumbPath; $imagesTable->image_small = $imageThumbPath; $imagesTable->image_size = $imageSize; $imagesTable->store(); } else { if ($imageSize > 0 && $imageSize == $imagesTable->image_size) { if (!JFile::exists($folderThumb . $thumbName)) { $imageThumbPath = $this->createThumbImageFolder($objImage); $imagesTable->image_medium = $imageThumbPath; $imagesTable->image_small = $imageThumbPath; $imagesTable->store(); } } } } else { if (JFile::exists($folderThumb . $thumbName)) { JSNISImageThumbNail::deleteThumbImage($arrayThumb); } } }