Author Topic: Sending image to crop script...  (Read 242 times)

0 Members and 1 Guest are viewing this topic.

Offline brainstorm316Topic starter

  • Irregular
  • Posts: 5
    • View Profile
Sending image to crop script...
« on: February 08, 2010, 03:19:01 PM »
Hi,

Sorry for the lame title, but the above is the only way I could describe my headache of a problem. I am a bit of a newb when it comes to PHP, but am starting to get the general idea(knowledge base is increasing anyway...).

I am building a social network using SocialEngine, and have completely customised the picture gallerys, and profile picture system(hence why I haven't posted this elsewhere).

Currently the system allows users to upload photos to an album, and seperately add their profile picture. I am about 70% of the way through integrating these 2 functions together, but have now hit a major problem.

So basically what I'm asking for is either advice on what I should be doing, or help(if your feeling really friendly) to actualy make the changes.

Line 117 of user_album_update.tpl (template file), this is what I have added to create a link which should generate "http://mysite.com/user_editprofile_photo2.php?photoid=./uploads_user/USERID/IMAGEID.jpg", which it does.

<div style='float: left; padding-right: 10px;' id='profilephotomsg_{$files[files_loop].media_id}'><a href="user_editprofile_photo2.php?photoid={$file_orig}"><img src='./images/icons/profile_editphoto_dim16.gif' border='0' class='button'>{lang_print id=20000801}</a></div>


I then need this "photoid" to be assigned in user_editprofile_photo2.php as the image file to move/crop/copy/edit etc INSTEAD of the script recieving an uploaded file as it was supposed to in its original format. This is where I am getting stuck, I have tried a million and one different variations, and have got nowhere. Just blankness where photos should be!

I have deleted the code from user_editprofile_photo2.tpl so it goes straight to the cropping procedure.

UvumiCrop-compressed.js is the photo cropping javascript, the other files are pasted below with user_editprofile_photo2.php being the original file that works for the profile picture upload:

{include file='header.tpl'}

{* 
$Iduser_album_update.tpl 293 2010-01-21 01:16:21Z phil $ *}

<
img src='./images/icons/album_image48.gif' border='0' class='icon_big'>
<
div class='page_header'>{lang_print id=1000095} <a href='{$url->url_create('album', $user->user_info.user_username, $album_info.album_id)}'>{$album_info.album_title}</a></div>
<
div>
  {
lang_sprintf id=1000096 1=$files_total 2=$album_info.album_views}</b>
</
div>

<
br>

{* 
SHOW RESULT MESSAGE *}
{if 
$result != && $files_total 0}
  <
table cellpadding='0' cellspacing='0'>
  <
tr><td class='success'><img src='./images/success.gif' border='0' class='icon'> {lang_print id=191}</td></tr>
  </
table>
  <
br>
{/if}

{* 
SHOW NO FILES MESSAGE IF NECESSARYOTHERWISE SHOW ALBUM STATS *}
{if 
$files_total == 0}
  <
table cellpadding='0' cellspacing='0'>
  <
tr><td class='result'>
    <
img src='./images/icons/bulb16.gif' border='0' class='icon'>{lang_print id=1000100} <a href='user_album_upload.php?album_id={$album_info.album_id}'>{lang_print id=1000101}</a>
  </
td></tr></table>
  <
br>
{/if}

<
div>
  <
div class='button' style='float: left;'>
    <
img src='./images/icons/back16.gif' border='0' class='button'><a href='user_album.php'>{lang_print id=1000097}</a>
  </
div>
  <
div class='button' style='float: left; padding-left: 20px;'>
    <
img src='./images/icons/album_addimages16.gif' border='0' class='button'><a href='user_album_upload.php?album_id={$album_info.album_id}'>{lang_print id=1000098}</a>
  </
div>
  <
div class='button' style='float: left; padding-left: 20px;'>
    <
img src='./images/icons/album_edit16.gif' border='0' class='button'><a href='user_album_edit.php?album_id={$album_info.album_id}'>{lang_print id=1000099}</a>
  </
div>
  <
div style='clear: both; height: 0px;'></div>
</
div>

{* 
SHOW FILES IF THERE ARE ANY *}
{if 
$files_total 0}
  <
form action='user_album_update.php' method='POST'>
  {
section name=files_loop loop=$files}

    {* 
ASSIGN FIRST ID *}
    {if 
$smarty.section.files_loop.first}{assign var='first_media_id' value=$files[files_loop].media_id}{/if}

    {* IF 
IMAGEGET THUMBNAIL *}
    {
assign var='has_thumb' value='0'}

    {if 
$files[files_loop].media_ext == "jpeg" || $files[files_loop].media_ext == "jpg" || $files[files_loop].media_ext == "gif" || $files[files_loop].media_ext == "png" || $files[files_loop].media_ext == "bmp"}
      {
assign var='file_dir' value=$url->url_userdir($user->user_info.user_id)}
      {
assign var='file_orig' value="`$file_dir``$files[files_loop].media_id`.jpg"}
      {
assign var='file_src' value="`$file_dir``$files[files_loop].media_id`_thumb.jpg"}
      {
assign var='has_thumb' value='1'}
    {* 
SET THUMB PATH FOR AUDIO *}
    {elseif 
$files[files_loop].media_ext == "mp3" || $files[files_loop].media_ext == "mp4" || $files[files_loop].media_ext == "wav"}
      {
assign var='file_src' value='./images/icons/audio_big.gif'}
    {* 
SET THUMB PATH FOR VIDEO *}
    {elseif 
$files[files_loop].media_ext == "mpeg" || $files[files_loop].media_ext == "mpg" || $files[files_loop].media_ext == "mpa" || $files[files_loop].media_ext == "avi" || $files[files_loop].media_ext == "swf" || $files[files_loop].media_ext == "mov" || $files[files_loop].media_ext == "ram" || $files[files_loop].media_ext == "rm"}
      {
assign var='file_src' value='./images/icons/video_big.gif'}
    {* 
SET THUMB PATH FOR UNKNOWN *}
    {else}
      {
assign var='file_src' value='./images/icons/file_big.gif'}
    {/if}

    <
div class='album' style='width: 670px;' id='media_{$files[files_loop].media_id}'>
      <
a name='{$files[files_loop].media_id}'></a>
      <
table cellpadding='0' cellspacing='0'>
      <
tr>
      <
td class='album_left'>
        <
div class='album_photo'>
          <
table cellpadding='0' cellspacing='0' width='200' height='200'>
          <
tr><td><a href='{$url->url_create('album_file', $user->user_info.user_username, $album_info.album_id, $files[files_loop].media_id)}'><img src='{$file_src}' id='file_{$files[files_loop].media_id}' {if $has_thumb == 1}width='200' height='200' {/if}border='0' style='vertical-align: middle;'></a></td></tr>
	
  </
table>
	
</
div>
      </
td>
      <
td class='album_right' width='100%'>
        <
div>
          {
lang_print id=1000046}<br>
          <
input type='text' name='media_title_{$files[files_loop].media_id}' class='text' size='35' maxlength='50' value='{$files[files_loop].media_title}'>
        </
div>
        <
div style='margin-top: 10px;'>
          {
lang_print id=1000102}<br>
          <
textarea name='media_desc_{$files[files_loop].media_id}' rows='3' cols='30' style='width: 400px'>{$files[files_loop].media_desc}</textarea>
        </
div>
        <
div style='margin-top: 10px;'>
          <
div style='float: left;'><input type='checkbox' name='delete[]' id='delete_media_{$files[files_loop].media_id}' value='{$files[files_loop].media_id}'></div>
          <
div style='float: left; padding-top: 1px;'><label for='delete_media_{$files[files_loop].media_id}'>{lang_print id=1000103}</label></div>
          <
div style='float: left; padding-left: 10px;'><input type='radio' name='album_cover' id='album_cover_{$files[files_loop].media_id}' value='{$files[files_loop].media_id}'{if $album_info.album_cover == $files[files_loop].media_idchecked='checked'{/if}></div>
          <
div style='float: left; padding-top: 1px;'><label for='album_cover_{$files[files_loop].media_id}'>{lang_print id=1000104}</label></div>
	
  {if 
$albums_total != 0}
            <
div style='float: left; padding-left: 17px;'>
	
      {
lang_print id=1000105
	
      <
select name='media_album_id_{$files[files_loop].media_id}' class='album_moveto'>
	
      <
option value='{$files[files_loop].media_album_id}'></option>
	
      {
section name=album_loop loop=$albums}
	
        <
option value='{$albums[album_loop].album_id}'>{$albums[album_loop].album_title|truncate:28:"...":true}</option>
	
      {/
section}
	
      </
select>
            </
div>
	
  {/if}
	

          <
div style='clear: both; height: 0px;'></div>
          {if 
$smarty.section.files_loop.first != true || $files[files_loop].media_ext == "jpeg" || $files[files_loop].media_ext == "jpg" || $files[files_loop].media_ext == "gif" || $files[files_loop].media_ext == "png" || $files[files_loop].media_ext == "bmp"}
	
    <
div class='album_options2'>
              {if 
$files[files_loop].media_ext == "jpeg" || $files[files_loop].media_ext == "jpg" || $files[files_loop].media_ext == "gif" || $files[files_loop].media_ext == "png" || $files[files_loop].media_ext == "bmp"}
	
        <
div style='float: left; padding-right: 10px;'><a href='javascript:void(0);' onClick="$('ajaxframe').src='user_album_update.php?task=rotate&dir=cc&album_id={$album_info.album_id}&media_id={$files[files_loop].media_id}';this.blur();"><img src='./images/icons/album_rotate_left16.gif' border='0' class='button'>{lang_print id=1000115}</a></div>
	
        <
div style='float: left; padding-right: 10px;'><a href='javascript:void(0);' onClick="$('ajaxframe').src='user_album_update.php?task=rotate&dir=c&album_id={$album_info.album_id}&media_id={$files[files_loop].media_id}';this.blur();"><img src='./images/icons/album_rotate_right16.gif' border='0' class='button'>{lang_print id=1000116}</a></div>
	
     {* 
SET PROFILE PHOTO KMODS *}
            {if 
$files[files_loop].media_ext == "jpeg" || $files[files_loop].media_ext == "jpg" || $files[files_loop].media_ext == "gif" || $files[files_loop].media_ext == "png" || $files[files_loop].media_ext == "bmp"}
                {if 
$user->user_info.user_photo == $file_dir|cat:$files[files_loop].media_id|cat:'_thumb.jpg'}
                  <
div style='float: left; padding-right: 10px;' id='profilephotomsg_{$files[files_loop].media_id}'><img src='./images/icons/profile_editphoto16.gif' border='0' class='button'><strong>{lang_print id=20000802}</strong></div>
                {else}
                  <
div style='float: left; padding-right: 10px;' id='profilephotomsg_{$files[files_loop].media_id}'><a href="user_editprofile_photo2.php?photo={$file_orig}"><img src='./images/icons/profile_editphoto_dim16.gif' border='0' class='button'>{lang_print id=20000801}</a></div>
                {/if}
            {/if}
	
      {/if}
	
      <
div style='float: left; padding-right: 10px;{if $smarty.section.files_loop.first}display: none;{/if}' id='moveup_{$files[files_loop].media_id}'><a href='javascript:void(0);' onClick="$('ajaxframe').src='user_album_update.php?task=moveup&album_id={$album_info.album_id}&media_id={$files[files_loop].media_id}';"><img src='./images/icons/album_moveup16.gif' border='0' class='button'>{lang_print id=1000114}</a></div>
	
      <
div style='clear: both; height: 0px;'></div>
	
    </
div>
          {/if}
        </
div>
      </
td>
      </
tr>
      </
table>
    </
div>`_thumb.jpg
  {/section}

  <br>

  <table cellpadding='0' cellspacing='0'>
  <tr>
  <td>
    <input type='submit' class='button' value='{lang_print id=173}'>&nbsp;
    <input type='hidden' name='task' value='doupdate'>
    <input type='hidden' name='album_id' value='
{$album_info.album_id}'>
    </form>
  </td>
  </tr>
  </table>

  {* JAVASCRIPT FOR MOVING IMAGES *}
  {literal}
  <script type="text/javascript">
  <!-- 

    var first_id = '{/literal}
{$first_media_id}{literal}';
    function reorderMedia(id, prev_id) {
      if(prev_id == first_id) {
        $('moveup_'+prev_id).style.display = 'block';
        $('moveup_'+id).style.display = 'none';
        first_id = id;
      }    
      $('media_'+id).inject('media_'+prev_id, 'before');
    }
  //-->
  </script>
  {/literal}


{/if}


{include file='footer.tpl'}


Contents of user_album_update.php

<?php

/* $Id: user_album_update.php 293 2010-01-21 01:16:21Z phil $ */

$page "user_album_update";
include 
"header.php";

if(isset(
$_POST['task'])) { $task $_POST['task']; } elseif(isset($_GET['task'])) { $task $_GET['task']; } else { $task "main"; }
if(isset(
$_GET['album_id'])) { $album_id $_GET['album_id']; } elseif(isset($_POST['album_id'])) { $album_id $_POST['album_id']; } else { $album_id 0; }

// ENSURE ALBUMS ARE ENABLED FOR THIS USER
if($user->level_info[level_album_allow] == 0) { header("Location: user_home.php"); exit(); }

// BE SURE ALBUM BELONGS TO THIS USER
$album $database->database_query("SELECT * FROM se_albums WHERE album_id='$album_id' AND album_user_id='".$user->user_info[user_id]."'");
if(
$database->database_num_rows($album) != 1) { header("Location: user_album.php"); exit(); }
$album_info $database->database_fetch_assoc($album);


// SET VARS
$result 0;
$album = new se_album($user->user_info[user_id]);



// ROTATE
if($task == "rotate") {
  
$media_id $_GET['media_id'];
  
$dir $_GET['dir'];

  if(
$dir == "cc") { $dir 90; } else { $dir 270; }

  
// ROTATE IMAGE
  
$album->album_media_rotate($media_id$dir);

  
// SET THUMBPATH
  
$thumb_path $url->url_userdir($user->user_info[user_id]).$media_id."_thumb.jpg?".rand();

  
// SEND AJAX CONFIRMATION
  
echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><script type='text/javascript'>";
  echo 
"var img = window.parent.document.getElementById('file_$media_id');";
  echo 
"img.src = '$thumb_path';";
  echo 
"</script></head><body></body></html>";
  exit();

// SET PROFILE PHOTO KMODS
} elseif($task == "setprofilephoto") {

	
$media_id $_GET['media_id'];
	
$media_ext $_GET['media_ext'];
	

	
if( 
stristr($user->user_info['user_photo'], 'upload') )
	
{
	
  
$old_photo substrstrrchr($user->user_info['user_photo'], '/'), 1strrpos(strrchr($user->user_info['user_photo'], '/'), ".")-7);
	
  
$thumb_path $url->url_userdir($album_info['album_user_id']).$media_id."_thumb.jpg";
	
}
	
else
	
{
	
  
$old_photo substr($user->user_info[user_photo],0,substr($user->user_info['user_photo'], 0strrpos($user->user_info['user_photo'], ".")-7));
	
  
$thumb_path $url->url_userdir($album_info['album_user_id']).$media_id."_thumb.jpg";
	
}
	

	
$database->database_query("UPDATE se_users SET user_photo='$thumb_path' WHERE user_id='".$user->user_info[user_id]."'");
	

	
// DETERMINE SIZE OF THUMBNAIL TO SHOW IN ACTION
      
$photo_width 100;
      
$photo_height 100;
	

	
// INSERT ACTION
    
$action_media = Array(Array('media_link'=>$url->url_create('profile'$user->user_info[user_username]), 'media_path'=>$thumb_path'media_width'=>$photo_width'media_height'=>$photo_height));
    
$actions->actions_add($user"editphoto", Array($user->user_info[user_username], $user->user_displayname), $action_media999999999TRUE"user"$user->user_info[user_id], $user->user_info[user_privacy]);
	

	

	
// SEND AJAX CONFIRMATION
	
echo 
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><script type='text/javascript'>";
    echo 
"window.parent.document.getElementById('profilephotomsg_$media_id').innerHTML = '<img src=\'./images/icons/profile_editphoto16.gif\' border=\'0\' class=\'button\'><strong>".SE_Language::get(20000802)."</strong>';";
	
echo 
"window.parent.document.getElementById('profilephotomsg_$old_photo').innerHTML = '<a href=\'javascript:void(0);\' onClick=\"\$(\'ajaxframe\').src=\'user_album_update.php?task=setprofilephoto&album_id={$album_info[album_id]}&media_id=$old_photo&media_ext=$media_ext\';this.blur();\"><img src=\'./images/icons/profile_editphoto_dim16.gif\' border=\'0\' class=\'button\'>".SE_Language::get(20000801)."</a>';";
	
// echo "window.parent.document.getElementById('profilephotomsg_$old_photo').innerHTML = '';";
    
echo "</script></head><body></body></html>";
    exit();



// UPDATE FILES IN THIS ALBUM
} elseif($task == "doupdate") {

  
// GET TOTAL FILES
  
$total_files $album->album_files($album_info[album_id]);

  
// DELETE NECESSARY FILES
  
$album->album_media_delete(0$total_files"media_id ASC""(media_album_id='$album_info[album_id]')");

  
// UPDATE NECESSARY FILES
  
$media_array $album->album_media_update(0$total_files"media_id ASC""(media_album_id='$album_info[album_id]')");

  
// SET ALBUM COVER AND UPDATE DATE
  
$newdate time();
  
$album_info[album_cover] = $_POST['album_cover'];
  if(!
in_array($album_info[album_cover], $media_array)) { $album_info[album_cover] = $media_array[0]; }
  
$database->database_query("UPDATE se_albums SET album_cover='$album_info[album_cover]', album_dateupdated='$newdate' WHERE album_id='$album_info[album_id]'");

  
// UPDATE LAST UPDATE DATE (SAY THAT 10 TIMES FAST)
  
$user->user_lastupdate();

  
// SHOW SUCCESS MESSAGE
  
$result 1;



// MOVE MEDIA UP
} elseif($task == "moveup") {
  
$media_id $_GET['media_id'];

  
$media_query $database->database_query("SELECT media_id, media_order, media_album_id FROM se_media LEFT JOIN se_albums ON se_media.media_album_id=se_albums.album_id WHERE media_id='$media_id' AND se_albums.album_user_id='".$user->user_info[user_id]."'");
  if(
$database->database_num_rows($media_query) == 1) { 

    
$media_info $database->database_fetch_assoc($media_query);

    
$prev_query $database->database_query("SELECT media_id, media_order FROM se_media LEFT JOIN se_albums ON se_media.media_album_id=se_albums.album_id WHERE se_media.media_album_id='$media_info[media_album_id]' AND se_albums.album_user_id='".$user->user_info[user_id]."' AND media_order<$media_info[media_order] ORDER BY media_order DESC LIMIT 1");
    if(
$database->database_num_rows($prev_query) == 1) {

      
$prev_info $database->database_fetch_assoc($prev_query);

      
// SWITCH ORDER
      
$database->database_query("UPDATE se_media SET media_order=$prev_info[media_order] WHERE media_id=$media_info[media_id]");
      
$database->database_query("UPDATE se_media SET media_order=$media_info[media_order] WHERE media_id=$prev_info[media_id]");

      
// SEND AJAX CONFIRMATION
      
echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><script type='text/javascript'>";
      echo 
"window.parent.reorderMedia('$media_info[media_id]', '$prev_info[media_id]');";
      echo 
"</script></head><body></body></html>";
      exit();

    } 
  }
}




// SHOW FILES IN THIS ALBUM
$total_files $album->album_files($album_info[album_id]);
$file_array $album->album_media_list(0$total_files"media_order ASC""(media_album_id='$album_info[album_id]')");


// GET LIST OF OTHER ALBUMS
$total_albums $album->album_total("album_id<>'$album_info[album_id]'");
$album_array $album->album_list(0$total_albums"album_order ASC""album_id<>'$album_info[album_id]'");


// ASSIGN VARIABLES AND SHOW UDPATE ALBUMS PAGE
$smarty->assign('result'$result);
$smarty->assign('files'$file_array);
$smarty->assign('files_total'$total_files);
$smarty->assign('album_info'$album_info);
$smarty->assign('albums'$album_array);
$smarty->assign('albums_total'$total_albums);
include 
"footer.php";
?>


Contents of user_album_update.tpl :

{include file='header.tpl'}

{* 
$Iduser_album_update.tpl 293 2010-01-21 01:16:21Z phil $ *}

<
img src='./images/icons/album_image48.gif' border='0' class='icon_big'>
<
div class='page_header'>{lang_print id=1000095} <a href='{$url->url_create('album', $user->user_info.user_username, $album_info.album_id)}'>{$album_info.album_title}</a></div>
<
div>
  {
lang_sprintf id=1000096 1=$files_total 2=$album_info.album_views}</b>
</
div>

<
br>

{* 
SHOW RESULT MESSAGE *}
{if 
$result != && $files_total 0}
  <
table cellpadding='0' cellspacing='0'>
  <
tr><td class='success'><img src='./images/success.gif' border='0' class='icon'> {lang_print id=191}</td></tr>
  </
table>
  <
br>
{/if}

{* 
SHOW NO FILES MESSAGE IF NECESSARYOTHERWISE SHOW ALBUM STATS *}
{if 
$files_total == 0}
  <
table cellpadding='0' cellspacing='0'>
  <
tr><td class='result'>
    <
img src='./images/icons/bulb16.gif' border='0' class='icon'>{lang_print id=1000100} <a href='user_album_upload.php?album_id={$album_info.album_id}'>{lang_print id=1000101}</a>
  </
td></tr></table>
  <
br>
{/if}

<
div>
  <
div class='button' style='float: left;'>
    <
img src='./images/icons/back16.gif' border='0' class='button'><a href='user_album.php'>{lang_print id=1000097}</a>
  </
div>
  <
div class='button' style='float: left; padding-left: 20px;'>
    <
img src='./images/icons/album_addimages16.gif' border='0' class='button'><a href='user_album_upload.php?album_id={$album_info.album_id}'>{lang_print id=1000098}</a>
  </
div>
  <
div class='button' style='float: left; padding-left: 20px;'>
    <
img src='./images/icons/album_edit16.gif' border='0' class='button'><a href='user_album_edit.php?album_id={$album_info.album_id}'>{lang_print id=1000099}</a>
  </
div>
  <
div style='clear: both; height: 0px;'></div>
</
div>

{* 
SHOW FILES IF THERE ARE ANY *}
{if 
$files_total 0}
  <
form action='user_album_update.php' method='POST'>
  {
section name=files_loop loop=$files}

    {* 
ASSIGN FIRST ID *}
    {if 
$smarty.section.files_loop.first}{assign var='first_media_id' value=$files[files_loop].media_id}{/if}

    {* IF 
IMAGEGET THUMBNAIL *}
    {
assign var='has_thumb' value='0'}

    {if 
$files[files_loop].media_ext == "jpeg" || $files[files_loop].media_ext == "jpg" || $files[files_loop].media_ext == "gif" || $files[files_loop].media_ext == "png" || $files[files_loop].media_ext == "bmp"}
      {
assign var='file_dir' value=$url->url_userdir($user->user_info.user_id)}
      {
assign var='file_orig' value="`$file_dir``$files[files_loop].media_id`.jpg"}
      {
assign var='file_src' value="`$file_dir``$files[files_loop].media_id`_thumb.jpg"}
      {
assign var='has_thumb' value='1'}
    {* 
SET THUMB PATH FOR AUDIO *}
    {elseif 
$files[files_loop].media_ext == "mp3" || $files[files_loop].media_ext == "mp4" || $files[files_loop].media_ext == "wav"}
      {
assign var='file_src' value='./images/icons/audio_big.gif'}
    {* 
SET THUMB PATH FOR VIDEO *}
    {elseif 
$files[files_loop].media_ext == "mpeg" || $files[files_loop].media_ext == "mpg" || $files[files_loop].media_ext == "mpa" || $files[files_loop].media_ext == "avi" || $files[files_loop].media_ext == "swf" || $files[files_loop].media_ext == "mov" || $files[files_loop].media_ext == "ram" || $files[files_loop].media_ext == "rm"}
      {
assign var='file_src' value='./images/icons/video_big.gif'}
    {* 
SET THUMB PATH FOR UNKNOWN *}
    {else}
      {
assign var='file_src' value='./images/icons/file_big.gif'}
    {/if}

    <
div class='album' style='width: 670px;' id='media_{$files[files_loop].media_id}'>
      <
a name='{$files[files_loop].media_id}'></a>
      <
table cellpadding='0' cellspacing='0'>
      <
tr>
      <
td class='album_left'>
        <
div class='album_photo'>
          <
table cellpadding='0' cellspacing='0' width='200' height='200'>
          <
tr><td><a href='{$url->url_create('album_file', $user->user_info.user_username, $album_info.album_id, $files[files_loop].media_id)}'><img src='{$file_src}' id='file_{$files[files_loop].media_id}' {if $has_thumb == 1}width='200' height='200' {/if}border='0' style='vertical-align: middle;'></a></td></tr>
	
  </
table>
	
</
div>
      </
td>
      <
td class='album_right' width='100%'>
        <
div>
          {
lang_print id=1000046}<br>
          <
input type='text' name='media_title_{$files[files_loop].media_id}' class='text' size='35' maxlength='50' value='{$files[files_loop].media_title}'>
        </
div>
        <
div style='margin-top: 10px;'>
          {
lang_print id=1000102}<br>
          <
textarea name='media_desc_{$files[files_loop].media_id}' rows='3' cols='30' style='width: 400px'>{$files[files_loop].media_desc}</textarea>
        </
div>
        <
div style='margin-top: 10px;'>
          <
div style='float: left;'><input type='checkbox' name='delete[]' id='delete_media_{$files[files_loop].media_id}' value='{$files[files_loop].media_id}'></div>
          <
div style='float: left; padding-top: 1px;'><label for='delete_media_{$files[files_loop].media_id}'>{lang_print id=1000103}</label></div>
          <
div style='float: left; padding-left: 10px;'><input type='radio' name='album_cover' id='album_cover_{$files[files_loop].media_id}' value='{$files[files_loop].media_id}'{if $album_info.album_cover == $files[files_loop].media_idchecked='checked'{/if}></div>
          <
div style='float: left; padding-top: 1px;'><label for='album_cover_{$files[files_loop].media_id}'>{lang_print id=1000104}</label></div>
	
  {if 
$albums_total != 0}
            <
div style='float: left; padding-left: 17px;'>
	
      {
lang_print id=1000105
	
      <
select name='media_album_id_{$files[files_loop].media_id}' class='album_moveto'>
	
      <
option value='{$files[files_loop].media_album_id}'></option>
	
      {
section name=album_loop loop=$albums}
	
        <
option value='{$albums[album_loop].album_id}'>{$albums[album_loop].album_title|truncate:28:"...":true}</option>
	
      {/
section}
	
      </
select>
            </
div>
	
  {/if}
	

          <
div style='clear: both; height: 0px;'></div>
          {if 
$smarty.section.files_loop.first != true || $files[files_loop].media_ext == "jpeg" || $files[files_loop].media_ext == "jpg" || $files[files_loop].media_ext == "gif" || $files[files_loop].media_ext == "png" || $files[files_loop].media_ext == "bmp"}
	
    <
div class='album_options2'>
              {if 
$files[files_loop].media_ext == "jpeg" || $files[files_loop].media_ext == "jpg" || $files[files_loop].media_ext == "gif" || $files[files_loop].media_ext == "png" || $files[files_loop].media_ext == "bmp"}
	
        <
div style='float: left; padding-right: 10px;'><a href='javascript:void(0);' onClick="$('ajaxframe').src='user_album_update.php?task=rotate&dir=cc&album_id={$album_info.album_id}&media_id={$files[files_loop].media_id}';this.blur();"><img src='./images/icons/album_rotate_left16.gif' border='0' class='button'>{lang_print id=1000115}</a></div>
	
        <
div style='float: left; padding-right: 10px;'><a href='javascript:void(0);' onClick="$('ajaxframe').src='user_album_update.php?task=rotate&dir=c&album_id={$album_info.album_id}&media_id={$files[files_loop].media_id}';this.blur();"><img src='./images/icons/album_rotate_right16.gif' border='0' class='button'>{lang_print id=1000116}</a></div>
	
     {* 
SET PROFILE PHOTO KMODS *}
            {if 
$files[files_loop].media_ext == "jpeg" || $files[files_loop].media_ext == "jpg" || $files[files_loop].media_ext == "gif" || $files[files_loop].media_ext == "png" || $files[files_loop].media_ext == "bmp"}
                {if 
$user->user_info.user_photo == $file_dir|cat:$files[files_loop].media_id|cat:'_thumb.jpg'}
                  <
div style='float: left; padding-right: 10px;' id='profilephotomsg_{$files[files_loop].media_id}'><img src='./images/icons/profile_editphoto16.gif' border='0' class='button'><strong>{lang_print id=20000802}</strong></div>
                {else}
                  <
div style='float: left; padding-right: 10px;' id='profilephotomsg_{$files[files_loop].media_id}'><a href="user_editprofile_photo2.php?photo={$file_orig}&task=upload&MAX_FILE_SIZE=5000000"><img src='./images/icons/profile_editphoto_dim16.gif' border='0' class='button'>{lang_print id=20000801}</a></div>
                {/if}
            {/if}
	
      {/if}
	
      <
div style='float: left; padding-right: 10px;{if $smarty.section.files_loop.first}display: none;{/if}' id='moveup_{$files[files_loop].media_id}'><a href='javascript:void(0);' onClick="$('ajaxframe').src='user_album_update.php?task=moveup&album_id={$album_info.album_id}&media_id={$files[files_loop].media_id}';"><img src='./images/icons/album_moveup16.gif' border='0' class='button'>{lang_print id=1000114}</a></div>
	
      <
div style='clear: both; height: 0px;'></div>
	
    </
div>
          {/if}
        </
div>
      </
td>
      </
tr>
      </
table>
    </
div>`_thumb.jpg
  {/section}

  <br>

  <table cellpadding='0' cellspacing='0'>
  <tr>
  <td>
    <input type='submit' class='button' value='{lang_print id=173}'>&nbsp;
    <input type='hidden' name='task' value='doupdate'>
    <input type='hidden' name='album_id' value='
{$album_info.album_id}'>
    </form>
  </td>
  </tr>
  </table>

  {* JAVASCRIPT FOR MOVING IMAGES *}
  {literal}
  <script type="text/javascript">
  <!-- 

    var first_id = '{/literal}
{$first_media_id}{literal}';
    function reorderMedia(id, prev_id) {
      if(prev_id == first_id) {
        $('moveup_'+prev_id).style.display = 'block';
        $('moveup_'+id).style.display = 'none';
        first_id = id;
      }    
      $('media_'+id).inject('media_'+prev_id, 'before');
    }
  //-->
  </script>
  {/literal}


{/if}


{include file='footer.tpl'}


Any help would be much appreciated, if I need to provide any more info, then please just ask.

Kind regards,

Kevin
« Last Edit: February 08, 2010, 03:23:06 PM by brainstorm316 »

Offline brainstorm316Topic starter

  • Irregular
  • Posts: 5
    • View Profile
Re: Sending image to crop script...
« Reply #1 on: February 08, 2010, 03:39:43 PM »
[NOTE: I tried to edit my post but it said the time had run out to edit]

Further info:

After adding the URL to assign the photoid=??, I tried to call that into user_editprofile_photo2.php by using the following code:



$photo 
$_GET['photoid'];



and then tried deleting the code that refers to $new_photo, and assigning $photo to $photo_newname.

No joy!

Offline brainstorm316Topic starter

  • Irregular
  • Posts: 5
    • View Profile
Re: Sending image to crop script...
« Reply #2 on: February 08, 2010, 06:20:41 PM »
Have I over complicated what I needed in the above? The simple explanation of what I am trying to do is successfully "$_GET" or "$_POST" the "photoid" variable I have added to the URL. I then need to assign this to equal "$photo" which can then be used to move and edit the image.

I think I can take it from there...

Any ideas?

Offline brainstorm316Topic starter

  • Irregular
  • Posts: 5
    • View Profile
Re: Sending image to crop script...
« Reply #3 on: February 09, 2010, 08:35:38 AM »
somebody made a good point to me on another forum i posted this on that i did a great job explaining the background of what im doing, but not the problem I am facing, so here goes:


basically when they click the "Set as Profile Picture" button, it loads the url as it should, but the user_edit_profilephoto2.php file does not seem to be able to pick up the photo. It displays no picture at all.

I know the value of the variable is correct as I have physically copied it into the img src of the cropper.

Firstly I am not convinced the $_GET['var'] is working correctly, ands secondly I'm not convinced the script is correct to then convert the $_GET['var'] the way it needs to when and if it is working.

Basically what user_edit_profilephoto2.php needs to do is use the $_GET['var'] to set the file location(instead of looking for an uploaded file that now doesn't exist), and then copy this file as $photo_newname. It should then proceed as it normally does to create the cropping image, and thumbnail, leaving the original file intact.