Answer the question
In order to leave comments, you need to log in
Output photos to two sites, from one folder, and upload photos from two sites to one folder ci?
How to implement this?
Two identical scripts are made, with different domains.
Purpose: Displaying photos on two sites, from one folder of the first site, and uploading photos from two sites to one folder of the first site. "so as not to fill the server with photo copies"
If this is possible...?
The Codeigniter framework
has some code:
// Check if the directory already exists
if (!file_exists("./uploads/photos/" . $user_id . "/")) {
mkdir("./uploads/photos/" . $user_id . "/");
mkdir("./uploads/photos/" . $user_id . "/thumbnails/");
}
// Copy the file to the correct directory
if (!empty($_FILES))
{
$nameFile = rand(0,999999).time();
$tempFile = $_FILES['upl']['tmp_name'];
$fileSize = $_FILES['upl']['size'];
$fileTypes = array('jpg','jpeg','png', 'JPG', 'JPEG', 'PNG'); // File extensions
$fileParts = pathinfo($_FILES['upl']['name']);
$targetPath = "./uploads/photos/" . $user_id . "/";
$targetPathThumb = $targetPath . "thumbnails/";
$targetPathEcho = "/uploads/photos/" . $user_id . "/";
$targetPathEchoThumb = "/uploads/photos/" . $user_id . "/thumbnails/";
$targetFile = str_replace('//','/',$targetPath) . $nameFile . "." . $fileParts["extension"];
$targetFileThumb = str_replace('//','/',$targetPathThumb) . $nameFile . "." . $fileParts["extension"];
$targetFileEcho = str_replace('//','/',$targetPathEcho) . $nameFile . "." . $fileParts["extension"];
$targetFileEchoThumb = str_replace('//','/',$targetPathEchoThumb) . $nameFile . "." . $fileParts["extension"];
if($fileSize <= 7000000)
{
// you can insert the result into the database if you want.
if($this->is_image($extension))
{
$config['image_library'] = 'gd2';
$config['source_image'] = './uploads/'.$filename;
$config['new_image'] = './uploads/thumbs/';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['thumb_marker'] = '';
$config['width'] = 300;
$config['height'] = 300;
$this->load->library('image_lib', $config);
$this->image_lib->resize();
echo 'image';
}
else echo 'file';
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question