Page 5 of 6 FirstFirst ... 3456 LastLast
Results 61 to 75 of 81

Thread: Plugin : Image Resize

  1. #61
    pimpmaster is offline Registered User
    Join Date
    Feb 2007
    Posts
    51

    Default Can´t get it to work with "pre-shrunk" pics

    I allow my linkowners to upload five pictures with their link. I´m using the following code on detail_link.html to show thumbnails:

    PHP Code:
    <a href="<%$pic1%>" rel="lightbox"><img src="thumb.php?src=<%$pic1%>&x=160&y=160&f=0" border="0"></a
    In theory it works fine, but it also means that the PHP-script is called every time the page is loaded. And since there are five pictures the same script is called five times.

    I would be able to do something like this:
    PHP Code:
    <if path-to-thumb/thumb_pic is empty>
      <%
    php%> include("thumb.php?src=<%$pic1%>&dest=<%$pic1%>&x=160&y=160&f=1"); <%/php%>
    // Creates a thumbnail if one doesn´t exist for the picture
    <else>
      <
    a href="<%$bild1%>" rel="lightbox"><img src="path-to-thumb/<%$pic1%>" border="0"></a>
    // Shows the thumbnail linked to the actual picture
    <end if> 
    The first problem is that I can´t get the PHP-include to work. Doesn´t it work to pass variables?
    Or do I have to write a separate PHP-script triggered with a cron-job to create the thumbnails. That would mean I´d have to run the cron-job all the time.

    How do you solve it? Please, need help, because I don´t want to slow down the servers with unecessary calls.

  2. #62
    echo@'s Avatar
    echo@ is offline Active Member
    Join Date
    Oct 2007
    Location
    UK Essex
    Posts
    591

    Post Smarty Image Resize Summary

    I just wanted to say thankyou to inspireme for finding this, its a must have and its smart to use a smarty function lib (plugin) than other solutions.
    You might aswell use the right tools that came with indexu.

    Also would like to thank antony for solving the problem for the "no images" fix for Deluxe versions of indexu.

    <%if $pictures|file_exists%>
    <%thumb file="$pictures" width="150" height="100" window="true" sharpen="true" link="true" hint="true" html='border="0"'%> <%/if%>
    Works like a charm.

    There are a couple of things I found that was a problem and would like to document to make it easier for others.


    • When using this plugin with mod rewrite you must ensure you put a base href at the top of either your header or the file your using this on eg:
      <base href="http://www.your-web-site.co.uk">
      as this plugin generates hardcoded relative paths like so
      images/cache/984922d153149524c50a388fd65feb9a.jpg
    • The url location for the file no-longer exists it seems the developer "Christoph Erdmann" is not arround for support, so I have attached the "smarty plugin" for download. The plugin has been renamed to a .txt file so rename to a .php file when you have downloaded

    • You must make sure you put this plugin in your "lib/smarty/plugins" directory, or else it wont work. From reading this thread several users didnt do this and wondered why it didnt work

    • You will have to create a directory in your indexu root called "images" then create a sub-directory called "cache". Make "cache"'s permissions writable chmod to 777.

    How to use this with lytebox?


    Download lytebox here

    <%if $image1|file_exists%>
    <h1>My Images</h1>
    <a href="http://www.your-web-site.co.uk/<%$image1%>" rel="lytebox[details]" title="<%$title%>">
    <%thumb file="$image1" width="150" window="true" sharpen="true" link="false" hint="true" html='border="0"'%>
    </a>

    <%/if%>
    Hope this helps make life easier for someone
    Attached Files Attached Files
    Last edited by echo@; 03-21-2009 at 02:09 PM.
    ____________________________
    http://www.articleconveyer.com
    Give Your Articles Exposure



  3. #63
    netclick is offline Registered User
    Join Date
    Jun 2008
    Posts
    65

    Default URL removed

    Can anyone else recommend a good image enlarge script? The URL has been removed from original post...

    cheers

  4. #64
    FSGDAG's Avatar
    FSGDAG is offline Moderator
    Join Date
    May 2007
    Location
    NJ, United States
    Posts
    1,651

    Default

    I assume you mean that when a user clicks on the image, it opens in a new window and enlarges.... lytebox is probably the best and most widely used.

    You can find it here
    FSGDAG | IndexU Hosting | Owner
    Website | NiceCoder Script Hosting and More! | Web4URL is For Sale!
    Follow Us On Twitter | FaceBook Profile | YouTube Videos

  5. #65
    netclick is offline Registered User
    Join Date
    Jun 2008
    Posts
    65

    Default

    Thanks for that! I am checking it out now

  6. #66
    netclick is offline Registered User
    Join Date
    Jun 2008
    Posts
    65

    Default

    Wow, this is an awesome script, thanks for the heads-up FSGDAG!
    i will let you know how I go!

  7. #67
    weswa is offline Registered User
    Join Date
    Oct 2007
    Posts
    136

    Default

    probably a stupid question, but where do I put the /lytebox_v3.22 folder?

    in the root?

  8. #68
    FSGDAG's Avatar
    FSGDAG is offline Moderator
    Join Date
    May 2007
    Location
    NJ, United States
    Posts
    1,651

    Default

    You can create a folder with any name and put it in the root. When you call the javascript in the header, just use the relative path
    FSGDAG | IndexU Hosting | Owner
    Website | NiceCoder Script Hosting and More! | Web4URL is For Sale!
    Follow Us On Twitter | FaceBook Profile | YouTube Videos

  9. #69
    weswa is offline Registered User
    Join Date
    Oct 2007
    Posts
    136

    Default

    Hi FSGDAG,

    Thank you for helping. I added the code to detail_link.html as follows, but the lytebox does not show up if you click the image on Senwa - Senwa

    The code to detail_link.html is now:

    <base href="http://www.inschoonhoven.nl">
    <%$hook_html_link_detail_begin%>

    <%* - Begin javascript area---- *%>
    <link type="text/css" rel="stylesheet" href="<%$tpl_base%>/star_rating.css"/>
    <script language="javascript" type="text/javascript" src="<%$tpl_base%>/jquery.js"></script>
    <script language="javascript" type="text/javascript" src="<%$tpl_base%>/star_rating.js"></script>
    <div style="display:none" id="themesUrl"><%$tpl_base%></div>
    <div style="display:none" id="site_url"><%$site_url%></div>
    <script type="text/javascript" language="javascript" src="<%$site_url%>/lytebox_v3.22/lytebox.js"></script>
    <link rel="stylesheet" href="lytebox.css" type="text/css" media="screen" />

    <%* - end javascript area------ *%>
    ...
    ..
    <td>Afbeeldingen</td>
    <td><%if $afbeelding|file_exists%>
    <a href="http://www.inschoonhoven.nl/<%$afbeelding%>" rel="lytebox[details]" title="<%$title%>">
    <%thumb file="$afbeelding" width="300" window="true" sharpen="true" link="false" hint="true" html='border="0"'%>
    </a><%/if%>
    </td>


    also I added function.thumb.php to lib/smarty/plugins/

    Would you know what I have done wrong?

    Thanks,
    Wessel

  10. #70
    FSGDAG's Avatar
    FSGDAG is offline Moderator
    Join Date
    May 2007
    Location
    NJ, United States
    Posts
    1,651

    Default

    I haven't done a lytebox install in a while, but here are my suggestions:

    First :

    Code:
    <script type="text/javascript" language="javascript" src="<%$site_url%>/lytebox_v3.22/lytebox.js"></script>
    Make it a little easier on yourself. First, hardcode the address instead of using <%$site_url%>. Second, change the folder name from 'lytebox_v3.22' to just 'lytebox'.

    Second:

    Code:
    <a href="http://www.inschoonhoven.nl/<%$afbeelding%>" rel="lytebox[details]" title="<%$title%>">
    I'm not sure about the rel="lytebox[details]". Unless they have change something in a newer release, my code always just used rel="lytebox"

    Lastly:

    Code:
    <%thumb file="$afbeelding" width="300" window="true" sharpen="true" link="false" hint="true" html='border="0"'%>
    I'm also not sure about this. I would think that instead of the thumb file statement you would want to use a img src statement. I would also think you would need to use <%$afbeelding%>

    So to bring it all together I probably would try something like this:

    Code:
    <td><%if $afbeelding|file_exists%>
    <a href="http://www.inschoonhoven.nl/<%$afbeelding%>" rel="lytebox" title="<%$title%>">
    <img src="<%$afbeelding%>" width="300" window="true" sharpen="true" link="false" hint="true" html='border="0"'%>
    Please understand, I'm NOT a programmer, nor am I an expert in this. I've just been hacking around with IndexU Deluxe for the last couple of years now and have been learning from other members ( in the past ) like Inspireme, echo@, Bruceper, etc. Try what I've suggested, if it doesn't work then post back and we can continue trying different things. Otherwise, maybe one of the programmers can chime in and let us know if we are on track or not
    FSGDAG | IndexU Hosting | Owner
    Website | NiceCoder Script Hosting and More! | Web4URL is For Sale!
    Follow Us On Twitter | FaceBook Profile | YouTube Videos

  11. #71
    echo@'s Avatar
    echo@ is offline Active Member
    Join Date
    Oct 2007
    Location
    UK Essex
    Posts
    591

    Default

    Weswa

    I think this is where you are going wrong in red.


    <script type="text/javascript" language="javascript" src="<%$site_url%>/lytebox_v3.22/lytebox.js"></script>
    <link rel="stylesheet" href="lytebox.css" type="text/css" media="screen" />

    I might be wrong (im a little rusty at the mo), so if you can for instance render the page and look at this section of code and tell me it if looks like

    PHP Code:
    <script type="text/javascript" language="javascript" src="<http://www.inschoonhoven.nl/http://www.inschoonhoven.nl//lytebox_v3.22/lytebox.js"></script> 
    The <base href="http://www.inschoonhoven.nl"> is more than likely adding an extra site url to the path.

    I would of done this but i can't find any sample detail_links.html on your site.

    Let me know
    ____________________________
    http://www.articleconveyer.com
    Give Your Articles Exposure



  12. #72
    weswa is offline Registered User
    Join Date
    Oct 2007
    Posts
    136

    Default

    Hi FSGDAG and @echo,

    Thank you for helping. I changed the code like you adviced, but in IE the image does not show, and in FF the image is visible and if you click on it , it enlarges in a standard way (not with lytebox it seems). The code I have in detail_link.html is now:

    <base href="http://www.inschoonhoven.nl">
    <%$hook_html_link_detail_begin%>

    <%* - Begin javascript area---- *%>
    <link type="text/css" rel="stylesheet" href="<%$tpl_base%>/star_rating.css"/>
    <script language="javascript" type="text/javascript" src="<%$tpl_base%>/jquery.js"></script>
    <script language="javascript" type="text/javascript" src="<%$tpl_base%>/star_rating.js"></script>
    <div style="display:none" id="themesUrl"><%$tpl_base%></div>
    <div style="display:none" id="site_url"><%$site_url%></div>
    <script type="text/javascript" language="javascript" src="http:///www.schoonhoven.nl/lytebox/lytebox.js"></script>
    <link rel="stylesheet" href="lytebox.css" type="text/css" media="screen" />

    <%* - end javascript area------ *%>

    ...
    ..

    <td>Afbeeldingen</td>
    <td><%if $afbeelding|file_exists%>
    <a href="http://www.inschoonhoven.nl/<%$afbeelding%>" rel="lytebox" title="<%$title%>">
    <img src="<%$afbeelding%>" width="530" window="true" sharpen="true" link="false" hint="true" html='border="0"'%>
    </a><%/if%>
    </td>



    an example of a test-link with image is here: Senwa - Senwa

    The source code shown in the browser for this page is:

    <td>Afbeeldingen</td>
    <td> <a href="http://www.inschoonhoven.nl/upload_files/afbeelding_1.jpg" rel="lytebox" title="Senwa - Senwa">
    <img src="upload_files/afbeelding_1.jpg" width="530" window="true" sharpen="true" link="false" hint="true" html='border="0"'%>
    </a> </td>
    <td>

    Would you have any clue what I am still doing wrong here?

    Thanks and regards,
    Wessel

  13. #73
    echo@'s Avatar
    echo@ is offline Active Member
    Join Date
    Oct 2007
    Location
    UK Essex
    Posts
    591

    Default

    Lets fix the first problem,

    The reason your image is not displaying in IE is because IE 7 and above is more CSS compliant, IE ignores the base href in the body of the page (unlike firefox) therefore you should put the base href in your detail_link.html <HEAD> section.

    This should fix this problem

    Check out IEBlog : All your <base> are belong to us

    as with lytebox not loading im still thinking about it ...
    ____________________________
    http://www.articleconveyer.com
    Give Your Articles Exposure



  14. #74
    weswa is offline Registered User
    Join Date
    Oct 2007
    Posts
    136

    Default

    Hi echo@,

    In detail_link.html is no head section. I tried 2 ways, both did not work;
    I added this at the top of the file:
    <head>
    <base href="http://www.inschoonhoven.nl">
    </head>

    and as there is a <thead> section, I tried adding:
    <base href="http://www.inschoonhoven.nl">
    there, but still no luck.

    Maybe <base href="http://www.inschoonhoven.nl"> needs to go into the <head> section of header.html?

    thanks and regards,
    wessel

  15. #75
    weswa is offline Registered User
    Join Date
    Oct 2007
    Posts
    136

    Default

    fixed -> i added <base href="http://www.inschoonhoven.nl"> to header.html and now it works.

    Thank you for advicing.

Page 5 of 6 FirstFirst ... 3456 LastLast

Similar Threads

  1. Can't resize text boxes
    By yorweb in forum v5.x
    Replies: 8
    Last Post: 02-03-2005, 09:29 PM
  2. How Do I Get An Image to Appear
    By craven in forum v5.x
    Replies: 4
    Last Post: 10-10-2003, 04:31 AM
  3. ReSize Images w/ ImageMagick
    By Todd in forum v3.2
    Replies: 5
    Last Post: 12-02-2002, 04:35 PM
  4. Image
    By marko in forum v5.x
    Replies: 15
    Last Post: 08-16-2002, 07:06 PM
  5. Different Image ??
    By ideavirus in forum v3.2
    Replies: 0
    Last Post: 07-12-2002, 12:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •