News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

APImage

Started by anteprimorac, April 18, 2012, 02:46:59 PM

Previous topic - Next topic

lurkalot

Here you go.


/////////////////////
// Set up the topic where the poll is.
$pollTopic = 3;

// Set poll topic subject
$polltext = "<center><b><h3>Subject = Abstract: Voting closes: 31 October 2010, 07:10:52</h3></b></center>" ;
/////////////////////

// Images per row.
$imagesPerRow = 3;

$pollResults = ssi_showPoll($pollTopic,'array');

// Just a counter..
$imageCount = 0;

global $scripturl, $context;

$patternImg = "/src=[\"']?([^\"']?.*(png|jpg|gif))[\"']?/i";

echo ' <center><b><h2>Poll for the weekly competition</h2></b></center> ';
echo $polltext ;

echo ' <hr> ';
echo '
      <table style="width: 100%">
         <tr>';

foreach ($pollResults['options'] as $pollItem)
{
   preg_match($patternImg, $pollItem['option'], $image);   
   
   $imageCount++;
   
   if ($imageCount > $imagesPerRow)
   {
      echo '
         </tr>
         <tr>';
   
      $imageCount = 1;
   }
   
   echo '
            <td style="width: 25%; text-align: center; padding: 1px 1px 10px 1px;">
               <a href="' , $scripturl , '?topic=' , $pollTopic , '">
                  <img ' , $image[0] , ' alt="Go Vote !" title="Go Vote !" border="0" width="100" />
               </a>
               <br />
               Member : ' , strip_tags($pollItem['option']);
               
   if (!$pollResults['allow_vote'] && !$context['user']['is_guest'])
   {
      echo '
               <br />
               Votes : ' , $pollItem['votes'] , ' (' , $pollItem['percent'] , '%)
               <br />
               ' , $pollItem['bar'];
   }

      echo '
            </td>';
     
}

while ($imageCount < $imagesPerRow)
{
   echo '
            <td style="width: 25%">
            </td>';
   
   $imageCount++;
}

echo '
         </tr>
      </table>';
echo ' <center><b>Please click on any image to take you to the poll</b></center> ';

anteprimorac

Replace with:
/////////////////////
// Set up the topic where the poll is.
$pollTopic = 3;

// Set poll topic subject
$polltext = "<center><b><h3>Subject = Abstract: Voting closes: 31 October 2010, 07:10:52</h3></b></center>" ;
/////////////////////

// Images per row.
$imagesPerRow = 3;

$pollResults = ssi_showPoll($pollTopic,'array');

// Just a counter..
$imageCount = 0;

global $scripturl, $context;

$patternImg = "/data-image=[\"']?([^\"']?.*(png|jpg|gif))[\"']?/i";

echo ' <center><b><h2>Poll for the weekly competition</h2></b></center> ';
echo $polltext ;

echo ' <hr> ';
echo '
      <table style="width: 100%">
         <tr>';

foreach ($pollResults['options'] as $pollItem)
{
   preg_match($patternImg, $pollItem['option'], $image);   
   
   $imageCount++;
   
   if ($imageCount > $imagesPerRow)
   {
      echo '
         </tr>
         <tr>';
   
      $imageCount = 1;
   }
   
   echo '
            <td style="width: 25%; text-align: center; padding: 1px 1px 10px 1px;">
               <a href="' , $scripturl , '?topic=' , $pollTopic , '">
                  <div class="apimage" data-image="' , $image[0] , '" data-width="100" />
               </a>
               <br />
               Member : ' , strip_tags($pollItem['option']);
               
   if (!$pollResults['allow_vote'] && !$context['user']['is_guest'])
   {
      echo '
               <br />
               Votes : ' , $pollItem['votes'] , ' (' , $pollItem['percent'] , '%)
               <br />
               ' , $pollItem['bar'];
   }

      echo '
            </td>';
     
}

while ($imageCount < $imagesPerRow)
{
   echo '
            <td style="width: 25%">
            </td>';
   
   $imageCount++;
}

echo '
         </tr>
      </table>';
echo ' <center><b>Please click on any image to take you to the poll</b></center> ';
My Mods:
APImage v0.3




Besplatni singlovi, doublovi, listići, ... svih sportova! - BalkanTips

anteprimorac

my mistake, this will work well:
/////////////////////
// Set up the topic where the poll is.
$pollTopic = 3;

// Set poll topic subject
$polltext = "<center><b><h3>Subject = Abstract: Voting closes: 31 October 2010, 07:10:52</h3></b></center>" ;
/////////////////////

// Images per row.
$imagesPerRow = 3;

$pollResults = ssi_showPoll($pollTopic,'array');

// Just a counter..
$imageCount = 0;

global $scripturl, $context;

$patternImg = "/data-image=[\"']?([^\"']?.*(png|jpg|gif))[\"']?/i";

echo ' <center><b><h2>Poll for the weekly competition</h2></b></center> ';
echo $polltext ;

echo ' <hr> ';
echo '
      <table style="width: 100%">
         <tr>';

foreach ($pollResults['options'] as $pollItem)
{
   preg_match($patternImg, $pollItem['option'], $image);   
   
   $imageCount++;
   
   if ($imageCount > $imagesPerRow)
   {
      echo '
         </tr>
         <tr>';
   
      $imageCount = 1;
   }
   
   echo '
            <td style="width: 25%; text-align: center; padding: 1px 1px 10px 1px;">
               <a href="' , $scripturl , '?topic=' , $pollTopic , '">
                  <div class="apimage" ' , $image[0] , ' data-width="100"></div>
               </a>
               <br />
               Member : ' , strip_tags($pollItem['option']);
               
   if (!$pollResults['allow_vote'] && !$context['user']['is_guest'])
   {
      echo '
               <br />
               Votes : ' , $pollItem['votes'] , ' (' , $pollItem['percent'] , '%)
               <br />
               ' , $pollItem['bar'];
   }

      echo '
            </td>';
     
}

while ($imageCount < $imagesPerRow)
{
   echo '
            <td style="width: 25%">
            </td>';
   
   $imageCount++;
}

echo '
         </tr>
      </table>';
echo ' <center><b>Please click on any image to take you to the poll</b></center> ';


EDIT:
Link problem is resloved!
My Mods:
APImage v0.3




Besplatni singlovi, doublovi, listići, ... svih sportova! - BalkanTips

lurkalot

Thanks, it does now work.  But it's showing two images where each image should be. http://cctestsite.info

anteprimorac

Code in previous post is updated.
Quote from: lurkalot on June 03, 2012, 06:16:57 PM
Thanks, it does now work.  But it's showing two images where each image should be. http://cctestsite.info
What you mean?
My Mods:
APImage v0.3




Besplatni singlovi, doublovi, listići, ... svih sportova! - BalkanTips

lurkalot

Here's a screengrab,  ;)

anteprimorac

try this:
/////////////////////
// Set up the topic where the poll is.
$pollTopic = 3;

// Set poll topic subject
$polltext = "<center><b><h3>Subject = Abstract: Voting closes: 31 October 2010, 07:10:52</h3></b></center>" ;
/////////////////////

// Images per row.
$imagesPerRow = 3;

$pollResults = ssi_showPoll($pollTopic,'array');

// Just a counter..
$imageCount = 0;

global $scripturl, $context;

$patternImg = "/data-image=[\"']?([^\"']?.*(png|jpg|gif))[\"']?/i";

echo ' <center><b><h2>Poll for the weekly competition</h2></b></center> ';
echo $polltext ;

echo ' <hr> ';
echo '
      <table style="width: 100%">
         <tr>';

foreach ($pollResults['options'] as $pollItem)
{
   preg_match($patternImg, $pollItem['option'], $image);   
   
   $imageCount++;
   
   if ($imageCount > $imagesPerRow)
   {
      echo '
         </tr>
         <tr>';
   
      $imageCount = 1;
   }
   
   echo '
            <td style="width: 25%; text-align: center; padding: 1px 1px 10px 1px;">
               <a href="' , $scripturl , '?topic=' , $pollTopic , '">
                  <div class="apimage" ' , $image[0] , ' data-width="100"></div>
               </a>
               <br />
               Member : ' , strip_tags($pollItem['option']);
               
   if (!$pollResults['allow_vote'] && !$context['user']['is_guest'])
   {
      echo '
               <br />
               Votes : ' , $pollItem['votes'] , ' (' , $pollItem['percent'] , '%)
               <br />
               ' , $pollItem['bar'];
   }

      echo '
            </td>';
     
}

while ($imageCount < $imagesPerRow)
{
   echo '
            <td style="width: 25%">
            </td>';
   
   $imageCount++;
}

echo '
         </tr>
      </table>';
echo ' <center><b>Please click on any image to take you to the poll</b></center> ';
My Mods:
APImage v0.3




Besplatni singlovi, doublovi, listići, ... svih sportova! - BalkanTips

lurkalot

Really sorry for messing you about. You've spent a lot of time on this for me.

The images show correctly now, but they seem to be aligned to the left and not with the text below them as they used to be. 

Been thinking long and hard over this mod, and although it's a great mod, I'm now wondering if it's going to work out when using it with Tinyportal.  Trouble is it effects all images in my blocks, which I'd rather it didn't.  It would be great if I could make it ignore any images in my blocks.  Or my front page come to think of it.

anteprimorac

In version 0.3 you will be able to turn off mod on single image.
My Mods:
APImage v0.3




Besplatni singlovi, doublovi, listići, ... svih sportova! - BalkanTips

lurkalot

Quote from: anteprimorac on June 03, 2012, 07:05:06 PM
In version 0.3 you will be able to turn off mod on single image.

That sounds good.  Would be great if we could choose which images it's applied to. 

Would love it if it ignored portal blocks, unless required.  And the same for images entered into the poll option fields.  I'll wait for the next version then.  Good luck with that. ;)  Also If you'd like me to test, or you'd like to test yourself in Tinyportal etc, then just give me a shout.

anteprimorac

My Mods:
APImage v0.3




Besplatni singlovi, doublovi, listići, ... svih sportova! - BalkanTips

loplo

One more thing. Images are not being parsed and showed on facebook.

edgarlim

hello!

don't wanna hurry you, just wanna know when 0.3 is coming  ;)

ed

anteprimorac

Quote from: loplo on June 05, 2012, 09:45:33 AM
One more thing. Images are not being parsed and showed on facebook.
That will be resloved in new version.

Quote from: edgarlim on June 12, 2012, 12:45:58 PM
hello!

don't wanna hurry you, just wanna know when 0.3 is coming  ;)

ed
This weekend or next week ;)
My Mods:
APImage v0.3




Besplatni singlovi, doublovi, listići, ... svih sportova! - BalkanTips

edgarlim


anteprimorac

My Mods:
APImage v0.3




Besplatni singlovi, doublovi, listići, ... svih sportova! - BalkanTips

anteprimorac

First I want to apologize for the delay development of new versions. I'm sorry but you have to apprehend a few more days.
My Mods:
APImage v0.3




Besplatni singlovi, doublovi, listići, ... svih sportova! - BalkanTips

anteprimorac

Version 0.3
! APImage is turned off in signatures and Tinyportal blocks
+ New design
+ Custom scrollbar in gallery
+ Turn off APImage on a single image
+ Watermarks
+ Slideshow
+ Gallery tag button
+ Free advertising, submit your ad here
My Mods:
APImage v0.3




Besplatni singlovi, doublovi, listići, ... svih sportova! - BalkanTips

loplo

Wow, thanks.
Any instructions how to upgrade? Does it need some special moves? like backup some lines of code, delete, etc?

anteprimorac

- Uninstall and delete old version
- Upload and install new version

after installation you need to clear cache in your browser
My Mods:
APImage v0.3




Besplatni singlovi, doublovi, listići, ... svih sportova! - BalkanTips

Advertisement: