coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 upload => Topic started by: faptastic on May 31, 2006, 04:40:03 AM

Title: Hack Help: Show direct link to picture file after uploading it.
Post by: faptastic on May 31, 2006, 04:40:03 AM
[Does this count as a request?]

This is a hack which will show a direct link to the picture after uploading it.
After choosing the album to place it in, and pressing continue, the link appears at the bottom, so users can quickly copy and paste. I need this for a forum, as we want a moderatable image gallery/uploading place sort of like photobucket or imageshack.us. However, I'm new to coppermine, so this code should NOT BE USED except as demonstration.

In upload.php
replace

    // Create the form and echo more instructions.
    create_form($form_array);

    // More instructions.
    if(count($escrow_array) > '1') {

        form_statement($lang_upload_php['place_instr_2']);

    }

    // Make button say 'Continue.'
    close_form($lang_continue);


    // Close the table, create footers, and flush the output buffer.
    endtable();
    pagefooter();
    ob_end_flush();


with

    // Create the form and echo more instructions.
    create_form($form_array);

    // More instructions.
    if(count($escrow_array) > '1') {

        form_statement($lang_upload_php['place_instr_2']);

    }

    // Make button say 'Continue.'
    close_form($lang_continue);

//OMGHAX
if ($uploaded_pic != ""){
echo ("<tr><td>http://localhost/cpg/". $uploaded_pic."</td></tr>");
}
//end OMGHAX

    // Close the table, create footers, and flush the output buffer.
    endtable();
    pagefooter();
    ob_end_flush();


NOTE: You may want to replace localhost/cpg/ with the location of your gallery installation.

Although this is just a demonstration, that's what I'm aiming for. Is that fine for what I need, or is there a safer, better way to go about this?
Title: Re: Hack Help: Show direct link to picture file after uploading it.
Post by: Joachim Müller on May 31, 2006, 07:05:16 AM
Replacingecho ("<tr><td>http://localhost/cpg/". $uploaded_pic."</td></tr>");withecho ("<tr><td>".$CONFIG['ecards_more_pic_target']. $uploaded_pic."</td></tr>");should make this code work without the need to hardocde the URL of your gallery folder.
Title: Re: Hack Help: Show direct link to picture file after uploading it.
Post by: faptastic on May 31, 2006, 07:20:03 AM
Alright! Thanks so much! Oh, and by the way, sorry about forgetting to set version.  :P I'm a dolt.
Title: Re: Hack Help: Show direct link to picture file after uploading it.
Post by: DiaMirza.com on June 01, 2006, 11:01:26 PM
If you upload only one picture it doesn't shows the link to the uploaded file.
This is also the case, when you upload more than 1 picture, it shows the links to all except the last one.  ???