Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multi custom images per theme #12

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/admin/admin_theme_content.php
Expand Up @@ -3386,7 +3386,7 @@ function SaveHeaderImage(){
includeFile('tool/Images.php');
includeFile('tool/editing.php');
$page->ajaxReplace = array();
$dest_dir = $dataDir.'/data/_layouts/'.$this->curr_layout;
//$dest_dir = $dataDir.'/data/_layouts/'.$this->curr_layout; //Not used anywhere.


//source file
Expand Down Expand Up @@ -3489,7 +3489,7 @@ function SetImage($img_rel,$width,$height){
$save_info['height'] = $height;

$container = $_REQUEST['container'];
$gpLayouts[$this->curr_layout]['images'] = array(); //prevents shuffle
//$gpLayouts[$this->curr_layout]['images'] = array(); //prevents shuffle - REMOVED to allow images per container to be saved.
$gpLayouts[$this->curr_layout]['images'][$container] = array(); //prevents shuffle
$gpLayouts[$this->curr_layout]['images'][$container][] = $save_info;

Expand Down
4 changes: 2 additions & 2 deletions include/tool/gpOutput.php
Expand Up @@ -1126,8 +1126,8 @@ static function GetImage($src,$attributes = array()){
&& is_array($gpLayouts[$page->gpLayout]['images'][$container_id])
){
//echo showArray($gpLayouts[$page->gpLayout]['images'][$container_id]);
shuffle($gpLayouts[$page->gpLayout]['images'][$container_id]);
$image = current($gpLayouts[$page->gpLayout]['images'][$container_id]);
//shuffle($gpLayouts[$page->gpLayout]['images'][$container_id]); //Does not make sense ? There will always be only 1 entry in for this container as it is per img element
$image = $gpLayouts[$page->gpLayout]['images'][$container_id][0]; //call to current also not needed, there will only be 1 entry
$img_full = $dataDir.$image['img_rel'];
if( file_exists($img_full) ){
$img_rel = $image['img_rel'];
Expand Down