Welcome to TalkGraphics.com
Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22
  1. #11
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: I need a widget that will display a random photo each time pages is loaded.

    Excellent set of widgets Siran, worked like a charm. Saved to my web-goodies folder.
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  2. #12
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: I need a widget that will display a random photo each time pages is loaded.

    Sculptex/Siran

    Egg, did you place the file and folder in the root? Does your sever support PHP?
    I placed the php file in the same subfolder I uploaded the index pages to alongside the image folder.

    Yes, never had issues with php files before:

    http://www.parkeston.com/random/phpinfo.php
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  3. #13
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: I need a widget that will display a random photo each time pages is loaded.

    Because I can't get a double url on TG server:

    http://www.parkeston.com/random/random.php
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  4. #14
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: I need a widget that will display a random photo each time pages is loaded.

    Whereas Sculptex's works as expected:

    http://random.prevoo.uk/random.php
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  5. #15

    Default Re: I need a widget that will display a random photo each time pages is loaded.

    The subdoman is not important, if you are using a subfolder then that's fine, you just need to create another folder within that called random with the images in.
    So you'd have:-
    public_html/random/index.htm
    public_html/random/random.php
    public_html/random/random/img1.jpg
    public_html/random/random/img2.jpg

    But Siran and Acorns solutions are better for xara anyway.

  6. #16
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,822

    Default Re: I need a widget that will display a random photo each time pages is loaded.

    Quote Originally Posted by sculptex View Post
    The subdoman is not important, if you are using a subfolder then that's fine, you just need to create another folder within that called random with the images in.
    So you'd have:-
    public_html/random/index.htm
    public_html/random/random.php
    public_html/random/random/img1.jpg
    public_html/random/random/img2.jpg

    But Siran and Acorns solutions are better for xara anyway.
    sculptex, that is a generous suggestion but the power of TalkGrpahics is its diversity - let's say three solutions for the OP to pick from.
    I would be interested if JDunn can advise which work for the posed question.

    I hope others will also try and advise back or propose their approach.

    I'm obviously plugging mine as it can be changed to reflect siran's excellent solutions be including CSS styles separately and even replace the random element with a timer to cycle round as a carousel.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  7. #17
    Join Date
    Apr 2015
    Location
    Germany
    Posts
    927

    Default Re: I need a widget that will display a random photo each time pages is loaded.

    Hi sculptex,

    I don't think your solution has any disadvantage to the others, except depending on PHP. But if your server supports PHP your solution has the advantage that replacing the images is as easy as deleting and adding files from/to a folder.
    Just put your random.php file and the random folder (containing the pictures) to a support folder and it is as good for Xara as the other solutions.
    After adding and/or removing pictures to/form "your support folder"/random all you need to do is re-publish or export (and later upload with FTP or such) from within Xara.

    Attached is the "cover" variant of the widget examples above of your code (uploaded as a zip file because of the support folder).

    The following is meant to be addressed to other readers as I guess sculptex already knows everything about it...

    To change the scaling (just as Acorn already mentioned) change the "background-size:cover;" in the placeholder code to your needs (or give your DIV a class or ID and add some CSS).
    Remove it to only center and no scaling,
    change it to "background-size:contain;" to fit inside the placeholder,
    or to "background-size:100% 100%;" to fully stretch loosing the aspect ratio,
    or to "background-size:auto 100%;" to scale to same height,
    or to "background-size:100% auto;" to scale to same width.
    You may also change other attributes such as "background-position:center center;" to "background-position:left top;" (see for example https://www.w3schools.com/cssref/pr_...d-position.asp).
    Maybe there are other useful values... Acorn or sculptex might know better.
    Attached Files Attached Files

  8. #18
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: I need a widget that will display a random photo each time pages is loaded.

    Finally found my problem after a few hours searching. I need to add this line to my .htaccess file

    AddType application/x-httpd-php .htm .html
    Found it from this thread
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  9. #19
    Join Date
    Apr 2015
    Location
    Germany
    Posts
    927

    Default Re: I need a widget that will display a random photo each time pages is loaded.

    Glad you figured it out, but I don't understand why that was necessary.

  10. #20
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: I need a widget that will display a random photo each time pages is loaded.

    Nor do I Siran, it was just that pasting in even a very simple php code into a placeholder didn't function. It does now.
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

 

 

Tags for this Thread

Bookmarks

Posting Permissions

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