PHP and JavaScript Libaray
A library of web development code: PHP, server-side; JavaScript, client-side (browser).
<!DOCTYPE html>
<html>
<head>
<title>CyCarousel Basic Example</title>
<script src="CyCarousel.js" type="text/javascript"></script>
<style>
.Carousel {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
</style>
</head>
<body>
<div id="my-carousel">
<img src="carousel-page-01.jpg" />
<div>
<h1>An HTML page 2</h1>
<p>Some text here</p>
</div>
</div>
<script type="text/javascript">
const carousel = new Carousel("my-carousel");
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Customising CyCarousel Example</title>
<script src="CyCarousel.js" type="text/javascript"></script>
<style>
.Carousel {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
</style>
</head>
<body>
<div id="my-carousel">
<img src="carousel-page-01.jpg" />
<div>
<h1>An HTML page 2</h1>
<p>A custom page delay</p>
</div>
</div>
<script type="text/javascript">
// change starting values via an options object
const carousel = new Carousel("my-carousel", { transFx: Carousel.FX_SCROLL_RL, delay: 6000 });
// or via carousel properties
carousel.transOut.fx = Carousel.FX_ZOOM_OUT;
carousel.pages.page(1).delay = 4000;
</script>
</body>
</html>
CyCarousel
version - 5.1.0
CyCarousel is a simple to use, self-contained JavaScript HTML carousel (or slide-show). The single JavaScript file defines two classes, Carousel, and CarouselManager. The Carousel constructor takes an ID of an HTML element, it becoming the carousel frame, and it's children, the pages. Any element can be used as a page or poster. There are several transitions to be selected from, and in and out transitions, and page delay are all individually configurable.
Downloads
| CyCarousel.zip | CyCarousel file |
| CyCarousel-examples.zip | HTML demonstrating CyCarousel use. |
<?php
require_once 'init.php'; // $pathFile
require_once 'utils.php'; // array_get, valid_ident, valid_int
require_once 'CySendFile.php'; // send_file
// validate user input
$gallery = array_get($_GET, 'gallery');
if (($gallery !== null) && !valid_ident($gallery))
$gallery = null;
$imageId = array_get($_GET, 'image');
if (($imageId !== null) && !valid_int($imageId, 3))
$imageId = null;
if (isset($gallery) && isset($imageId)) {
// inputs look good
switch (strlen($imageId)) {
case 1: $imageId = '00' . $imageId; break;
case 2: $imageId = '0' . $imageId; break;
};
// build file path and check it exists
$sourceName = $pathFile . '/gallery/' . $gallery . '/image' . $imageId . '.jpg';
if (file_exists($sourceName))
send_file($sourceName);
else {
$internalErr = 404;
// raise a 404 error
}
}
else {
$internalErr = 403;
// raise a 403 error
}
?>
CySendFile
version - 1.0.1
The CySendFile PHP include allows a PHP file to appear as any other file. This can be used to provide secure download links, files linked to a database, or access to dynamic content. CySendFile supports HTTP bytes ranges, allowing download pause/resume and multi-thread downloads. Providing a user filename, prompts the browser to save the file. Mine type can be specified, or extention sniffed by CyFileMime.
Downloads
| CySendFile.zip | CySendFile and CyFileMime PHP includes. |
| CySendFile-examples.zip | Basic examples of CySendFile usage. |