GetSimple Support Forum
I18N Special Pages extras - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Plugins (http://get-simple.info/forums/forumdisplay.php?fid=13)
+--- Thread: I18N Special Pages extras (/showthread.php?tid=5653)

Pages: 1 2 3 4 5 6


RE: I18N Special Pages extras - mganko - 2017-10-20

I'm using this plugin for many pages in many many configurations and never had problems. Works with no problems with i18n special pages 1.3.5 and GS 3.3.12 or newer


RE: I18N Special Pages extras - mganko - 2017-10-20

(2017-10-11, 18:21:12)rio2000 Wrote: Hello.
I can't create more than 80 fields. What could be the problem?

Never had this problem. What you see? What's happening?


RE: I18N Special Pages extras - rio2000 - 2017-10-20

(2017-10-20, 22:56:38)mganko Wrote:
(2017-10-11, 18:21:12)rio2000 Wrote: Hello.
I can't create more than 80 fields. What could be the problem?

Never had this problem. What you see? What's happening?

no errors, the plugin does not give. Just the new fields are not saved.


RE: I18N Special Pages extras - mganko - 2017-10-20

(2017-10-20, 23:07:35)rio2000 Wrote:
(2017-10-20, 22:56:38)mganko Wrote:
(2017-10-11, 18:21:12)rio2000 Wrote: Hello.
I can't create more than 80 fields. What could be the problem?

Never had this problem. What you see? What's happening?

no errors, the plugin does not give. Just the new fields are not saved.
Please check on new clean install of GS with I18N special pages 1.3.5


RE: I18N Special Pages extras - ChronosMe1 - 2018-04-25

Hello! There is a problem with SSL. If I add HTTPS in the settings, then the thumbnails disappear. And I can not add new pictures.

I think the problem is somewhere in the validator.php. Smile


RE: I18N Special Pages extras - mganko - 2018-04-25

(2018-04-25, 19:21:00)ChronosMe1 Wrote: Hello! There is a problem with SSL. If I add HTTPS in the settings, then the thumbnails disappear. And I can not add new pictures.

I think the problem is somewhere in the validator.php. Smile

Enable debuging mode in GS  define('GSDEBUG',  true);
Try to open thumbnail url in browser, and see what is happening.


RE: I18N Special Pages extras - ChronosMe1 - 2018-04-26

(2018-04-25, 23:29:18)mganko Wrote:
(2018-04-25, 19:21:00)ChronosMe1 Wrote: Hello! There is a problem with SSL. If I add HTTPS in the settings, then the thumbnails disappear. And I can not add new pictures.

I think the problem is somewhere in the validator.php. Smile

Enable debuging mode in GS  define('GSDEBUG',  true);
Try to open thumbnail url in browser, and see what is happening.

If I enable debugging mode, this only works on the site, not on the admin area.
Pictures open normally. They are not visible only inside the editing page.

Here is an example: if I output direct links in the listing of pages (see attachments), pictures are available. If I open edit page, there are no pictures.

If I change https to http in settings/website URL, everything is fine.

If I open thumbnail url: https://vashdom-kazan.ru/plugins/SpecialPagesExtras/thumb/?mode=image-field-thumb&img=https%3A%2F%2Fvashdom-kazan.ru%2Fdata%2Fuploads%2Fworks%2Fwrk9.jpg 
he says "Wrong path"

UPDATE: Almost found the reason. The problem is in the validator.php file in function findImagePath ($url).


RE: I18N Special Pages extras - smsHH - 2018-06-05

I've got the same error here.

[Image: thumbnail_error.gif]

Michał, do you have an idea how to fix this?

Thank you in advance for your answer.


RE: I18N Special Pages extras - smsHH - 2018-06-05

(2016-08-03, 04:04:03)orrollo Wrote: also, was fixed the code. changed SPEValidator.php:

Code:
   public static function findImagePath($url){
       global $GSADMIN;
   
       $dataDirPart = str_replace(GSROOTPATH, '', GSDATAPATH); // "data/"
       $pluginsDirPart = str_replace(GSROOTPATH, '', GSPLUGINPATH); // "plugins/"
       $pluginsDirPart = str_replace(GSROOTPATH, '', GSPLUGINPATH); // "plugins/"

       $port = ($p = $_SERVER['SERVER_PORT'])!='80' && $p !='443' ? ':'.$p : '';
       $host = $_SERVER['SERVER_NAME'] . $port;
       $pathParts = pathinfo($_SERVER['PHP_SELF']);

       if ($pathParts['filename'] == 'changedata') //while saving page or while validating by ajax
           $subDir = substr($pathParts['dirname'], 0, strrpos($pathParts['dirname'], $GSADMIN)); //find page subdir
       else
           $subDir = substr($pathParts['dirname'], 0, strpos($pathParts['dirname'], $pluginsDirPart.'SpecialPagesExtras')); //find page subdir
       
       $siteHost = http_protocol()."://". $host;
       
       //delete site host and subdir and data from image url
       if ( substr($url, 0, strlen($siteHost.$subDir.$dataDirPart) ) == $siteHost.$subDir.$dataDirPart) {
           $path = substr($url, strlen($siteHost.$subDir.$dataDirPart));
       }
       else if (substr($url, 0, strlen($subDir.$dataDirPart) ) == $subDir.$dataDirPart){ //if its root relative (ex. /data/uploads/image.jpg)
           $path = substr($url, strlen($subDir.$dataDirPart));
       }
       else{ //wrong path, not full and root relative
           return false;
       }
           
       $file = basename($path);
       $subDir = tsl(dirname($path));
       
       return array('dir' => $subDir, 'filename' => $file, 'full' => GSDATAPATH.$path);
   }

orrollo, this fixed the problem - thank you for that solution. :-)


RE: I18N Special Pages extras - linden - 2018-08-07

(2015-03-11, 23:51:02)shawn_a Wrote: nono use foreach much easier to write and read, and faster then counting each iteration ( and your missing quotes )
PHP Code:
$images explode('||'get_special_field_image('image'));
foreach(
$images as $image){
 
 echo '<img src="'.$image.'">';


and if you need $i for index or something

PHP Code:
foreach($images as $key=>$image){
 
 //   echo  $key; // zero based index
 
 echo $key.'<img src="'.$image.'">';


Hello!

I tried using this foreach snippet and it works just fine.

But is there a way to also get the thumbnail for the image somehow?

I would need something like this:

$images = explode('||', get_special_field_image('image'));
foreach($images as $image){
echo '<a href="'.$image.'"><img src="'.$thumbnail.'"></a>';
}


RE: I18N Special Pages extras - vanfruniken - 2018-08-10

(2018-08-07, 23:42:03)linden Wrote:
(2015-03-11, 23:51:02)shawn_a Wrote: nono use foreach much easier to write and read, and faster then counting each iteration ( and your missing quotes )
PHP Code:
$images explode('||'get_special_field_image('image'));
foreach(
$images as $image){
 
 echo '<img src="'.$image.'">';


and if you need $i for index or something

PHP Code:
foreach($images as $key=>$image){
 
 //   echo  $key; // zero based index
 
 echo $key.'<img src="'.$image.'">';

...
But is there a way to also get the thumbnail for the image somehow?
I would need something like this:
PHP Code:
$images explode('||'get_special_field_image('image'));
foreach(
$images as $image){
  echo 
'<a href="'.$image.'"><img src="'.$thumbnail.'"></a>';


As far as I can tell (GS 3.3.13), the thumbnails that I have in /GS/data/uploads/path-to-imageFile/$imageFileName are automatically generated, and they can be found in two sizes:
as /GS/data/thumbs/path-to-imageFile/{'thumbnail.'$imageFileName} (200x200)
and as /GS/data/thumbs/path-to-imageFile/{'thumbsm.'$imageFileName} (48x48)

Up to you to generate the proper $thumbnail string for each $image. Probably better to store only 'path-to-imageFile/$imageFileName' in your special fields.


RE: I18N Special Pages extras - linden - 2018-08-11

(2018-08-10, 01:38:54)vanfruniken Wrote:
(2018-08-07, 23:42:03)linden Wrote:
(2015-03-11, 23:51:02)shawn_a Wrote: nono use foreach much easier to write and read, and faster then counting each iteration ( and your missing quotes )
PHP Code:
$images explode('||'get_special_field_image('image'));
foreach(
$images as $image){
 
 echo '<img src="'.$image.'">';


and if you need $i for index or something

PHP Code:
foreach($images as $key=>$image){
 
 //   echo  $key; // zero based index
 
 echo $key.'<img src="'.$image.'">';

...
But is there a way to also get the thumbnail for the image somehow?
I would need something like this:
PHP Code:
$images explode('||'get_special_field_image('image'));
foreach(
$images as $image){
 
 echo '<a href="'.$image.'"><img src="'.$thumbnail.'"></a>';


As far as I can tell (GS 3.3.13), the thumbnails that I have in /GS/data/uploads/path-to-imageFile/$imageFileName are automatically generated, and they can be found in two sizes:
as /GS/data/thumbs/path-to-imageFile/{'thumbnail.'$imageFileName} (200x200)
and as /GS/data/thumbs/path-to-imageFile/{'thumbsm.'$imageFileName} (48x48)

Up to you to generate the proper $thumbnail string for each $image. Probably better to store only 'path-to-imageFile/$imageFileName' in your special fields.

Thanks but i forgot to mention that i am using "Multi image field" and also I dont know PHP Sad
So I would greatly appreciate an example if anyone could help me.


RE: I18N Special Pages extras - vanfruniken - 2018-08-16

(2018-08-11, 21:51:44)linden Wrote: Thanks but i forgot to mention that i am using "Multi image field" and also I dont know PHP Sad
So I would greatly appreciate an example if anyone could help me.

Let me rephrase more precisely, with proper php syntax:

As far as I can tell (GS 3.3.13), thumbnails for each image, which should be located at
  $image = '/GS/data/' . 'uploads/' . $path_to_imageFile . $imageFileName


are automatically generated in two sizes:
- either (as 200x200) $thumbnail = '/GS/data/' . 'thumbs/' . $path_to_imageFile . 'thumbnail.' . $imageFileName
- or (as 48x48) $thumbnail = '/GS/data/' . 'thumbs/' . $path_to_imageFile . 'thumbsm.' . $imageFileName

Up to you to extract the proper $path_to_imageFile and $imageFileName for each $image from your "Multi image field". 

If you did store the complete $image in your "Multi image field", then

$thumbnail can be derived from $image by 
- first replacing 
  '/data/uploads/' with '/data/thumbs/' 
i.e.,
$partiallyFixedPath = str_replace('data/uploads/','data/thumbs',$image);
and
- also replacing
  $imageFileName with 'thumbnail.' . $imageFileName or 'thumbsm.' . $imageFileName
i.e.,
$imageFileName = pathinfo($image)['basename'];
$thumbnail = str_replace($imageFileName,'thumbnail.'.$imageFileName,$partiallyFixedPath);
or
$thumbnail = str_replace($imageFileName,'thumbsm.'.$imageFileName,$partiallyFixedPath);

I am not myself fluent with the special fields plugins, so I can't help with that kind of details.
Hope this helps.