Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7736619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:47:04+00:00 2026-06-01T07:47:04+00:00

At first, sorry for my bad english. I am using Uploadify with image cropper

  • 0

At first, sorry for my bad english.

I am using Uploadify with image cropper to upload and choose your own thumb, but I need to do a multi upload, not single. Now I´m trying to send before each upload – onSelect scriptData to server, but it send only one name, or rewriting it somewhere:( I tried change name of parameter, reset scriptData but with no effect. Problem is, that name of file must generate Javascript, which will send it to server (second option is do it by ajax), because Javascript then show the thumb.

EDIT Link is not working, if you want last version, contact jaroslav.streit@gmail.com

Test is running here http://nabytek-santy.cz/test/

index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN">
<html>

    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <title>Test uploadcropperu</title>
        <meta name="description" content="">
        <meta name="keywords" content="">
        <meta name="robots" content="index,follow">
        <meta name="author" content="HS Computers - www.hscomputers.cz">
        <link rel="stylesheet" media="screen" type="text/css" href="uploadcropper/uploadcropper.css">
        <link href='uploadcropper/uploadify/uploadify.css' type='text/css' rel='stylesheet' />
        <script type='text/javascript' src='uploadcropper/uploadify/jquery-1.4.2.min.js'>

        </script>
        <script type='text/javascript' src='uploadcropper/uploadify/swfobject.js'></script>
        <script type='text/javascript' src='uploadcropper/uploadify/jquery.uploadify.js'></script>
        <script type='text/javascript'>
            <!--
            sdiak = "áäčďéěíĺľňóô öŕšťúů üýřžÁÄČĎÉĚÍĹĽŇÓÔ ÖŔŠŤÚŮ ÜÝŘŽ";
            bdiak = "aacdeeillnoo orstuu uyrzAACDEEILLNOO ORSTUU UYRZ";

            function bezdiak(text) {
                tx = Math.floor(Math.random() * 1111111) + " ";
                txt = text;
                for (p = 0; p < txt.length; p++) {
                    if (sdiak.indexOf(txt.charAt(p)) != -1) {
                        tx += bdiak.charAt(sdiak.indexOf(txt.charAt(p)));
                    } else tx += txt.charAt(p);
                }
                tx = tx.replace(/ /g, "_");
                return tx;
            }
            nazev = "";

            function generuj_nazev(i) {
                neco = bezdiak(i);
                set_nazev(neco);
                return neco;
            }

            function set_nazev(i) {
                nazev = i;
            }

            function vypis_nazev() {
                return nazev;
            }

            function smazat(i) {
                if (confirm("Opravdu odstranit?")) {
                    var d = document.getElementById('url');
                    var olddiv = document.getElementById("radek" + i);
                    oFormObject = document.forms['form'];
                    d.removeChild(olddiv);
                    oFormObject = document.forms['form'];
                    pocet_obrazku = oFormObject.elements["pocet_obrazku"].value;
                    i = parseInt(pocet_obrazku);
                    oFormObject.elements["pocet_obrazku"].value = --i;
                }
            }

            function uprava_nahledu(nazev, id) {
                var img = new Image();
                img.src = "temp/neorezane_" + nazev;

                var width = img.width;
                var height = img.height;

                windowWidth = width + 100;
                windowHeight = height + 100;
                var centerWidth = (window.screen.width - windowWidth) / 2;
                var centerHeight = (window.screen.height - windowHeight) / 2;

                window.open("uploadcropper/uprava_nahledu.php?nazev=" + nazev + "&width=" + width + "&    height=" + height + "&id=" + id, "blank", "scrollbars=yes,toolbar=no,width=" + windowWidth + "px,height=" + windowHeight + "px,left=" + centerWidth + "px,top=" + centerWidth + "px");

            }

            function zmenObrazek(nazev, id) {
                document.getElementById('neco' + id).innerHTML = "";
                var img = $("<img />").attr('src', 'temp/smaller_' + nazev)
                    .load(function() {

                    $("#neco" + id).append(img);

                });
            }
            id_obrazku = 0;
            jQuery(document).ready(function() {

                $('#file_upload').uploadify({
                    'uploader': 'uploadcropper/uploadify/uploadify.swf',
                        'script': 'uploadcropper/uploadify/uploadify.php',
                        'cancelImg': 'uploadcropper/uploadify/cancel.png',
                        'folder': 'temp',
                        'multi': true,
                        'buttonText': 'Vybrat fotografie',
                        'fileExt': '*.jpg;*.jpeg;*.JPG;*.JPEG;',
                        'fileDesc': 'Fotografie, Obrázky, pouze JPG, JPEG',
                        'auto': true,
                        'method': 'POST',
                        'onSelect': function(event, ID, fileObj) {
                        $('#file_upload').uploadifySettings("scriptData", {
                            "nazev": generuj_nazev(fileObj.name)
                        });
                    },
                        'onComplete': function(event, ID, fileObj, response, data) {
                        nazev_obrazku = vypis_nazev();
                        //Validace extension
                        var fileName = fileObj.name;
                        var fileNameExt = fileName.substr(fileName.lastIndexOf('.') + 1);
                        //var validExtensions = new Array('jpg','jpeg');
                        if (fileNameExt == "jpg" || fileNameExt == "jpeg" || fileNameExt == "JPEG" || fileNameExt == "JPG") {
                            oFormObject = document.forms['form'];
                            pocet_obrazku = oFormObject.elements["pocet_obrazku"].value;

                            i = id_obrazku;
                            ++id_obrazku;
                            oFormObject.elements["pocet_obrazku"].value = ++pocet_obrazku;
                            fce = "uprava_nahledu('" + nazev_obrazku + "','" + i + "')";
                            var html = '';

                            html = '<div id="radek' + i + '" class="radek"><span class="tabulka_smazat"><img src="uploadcropper/delete.gif" alt="smazat" border="0" onclick="smazat(' + i + ');"></span><span class="ramecek"><div id="neco' + i + '"><img src="uploadcropper/edit.gif" alt="Upravit náhled" border="0" onclick="' + fce + '" class="button_edit"><img src="temp/small_' + nazev_obrazku + '" class="imgsmall" id="nahled' + i + '" title="Náhled obrázku" ></div></span><span class="hidden"><img src="temp/neorezane_' + nazev_obrazku + '" id="' + nazev_obrazku + '">Popis:<input name="popis' + i + '" id="popis' + i + '" type="text"></span><input id="file' + i + '" name="file' + i + '" type="text" value="' + nazev_obrazku + '">' + nazev_obrazku + ', cislo: ' + i + '</div>'
                            document.getElementById('url').innerHTML += html;
                        } else {
                            window.alert("Nesprávný typ souboru!");
                        }

                    }
                });


            });
        </script>
    </head>

    <body>
        <form method="POST" action="?obsah=ulozit&naz=reference&id=" id="form">
            <fieldset>
                <legend>Nahrávání a úprava obrázků</legend>
                <div class="admin_obrazky" class="admin_obrazky"> <span class="">Po vybrání obrázku se nahraje a zobrazí se automaticky ořezaný náhled, pokud vám ořez nevyhovuje, kliknutím na <img src="uploadcropper/edit.gif" class="ikona_text"> jej můžete ořezat. Ořez můžete provést jen jednou.</span>

                    <input id="file_upload" name="file_upload" type="file" />
                    <input id="pocet_obrazku" name="pocet_obrazku" type="text" value="0" />
                    <div id="url"></div>
                </div>
            </fieldset>
            <input type="submit" value="Vložit novou referenci" onclick="return checkform();">
            </p>
            <script language="JavaScript" type="text/javascript">
                //<!--
                function checkform() {
                    oFormObject = document.forms['form'];
                    if (oFormObject.elements["nadpis"].value == "") {
                        window.alert("Vyplňte prosím nadpis.");
                        return false;
                    } else {
                        return true;
                    }
                }
                //-->
            </script>
        </form>
    </body>    
</html>

uploadify.php:

<?php
    include("resize.php");

    if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';

    $nazev_souboru = $_POST["nazev"];

    $targetFile_neorezane =  str_replace('//','/',$targetPath) ."neorezane_".$nazev_souboru;
    $targetFile_small =  str_replace('//','/',$targetPath) . "small_" . $nazev_souboru;
    $targetFile =  str_replace('//','/',$targetPath) . $nazev_souboru;



     $fileTypes  = str_replace('*.','',$_REQUEST['fileext']);
     $fileTypes  = str_replace(';','|',$fileTypes);
     $typesArray = split('\|',$fileTypes);
     $fileParts  = pathinfo($_FILES['Filedata']['name']);

     if (in_array($fileParts['extension'],$typesArray)) {
        // ulozit do tempu a zmensit pro nahled
    Resizer_thumb($tempFile,$targetFile_small,166,124);
    // zjisti, zda je obrazek na vysku nebo na sirku
    list($OrigWidth, $OrigHeight) = getimagesize($tempFile);
    if($OrigWidth/$OrigHeight<=1.338){
    // na vysku
    Resizer($tempFile,$targetFile_neorezane,166,0);
    }
    else{
    // na sirku
    Resizer($tempFile,$targetFile_neorezane,0,124);
    }

    Resizer($tempFile,$targetFile,640,640);

     } else {
        echo 'Nevhodný typ souboru.';
     }

    chmod($targetFile, 0666);

    } 
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:47:06+00:00Added an answer on June 1, 2026 at 7:47 am

    I solved it! I generate random string in onSelect and send by scriptData. Then all files (I assume they have different file names) have this code before filename. If somebody want code, send me a message.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First, sorry for my bad english. I am using the mpstat tool in Ubuntu
First : Appologize for my bad english. Sorry for this newbie software question, but
First, sorry for bad english :-) On a little website i own, i would
first of all, sorry for my bad english, isnt my native language. Im using
At first sorry my bad English. I want define routing for this url: For
at first sorry my bad English I want load model in my plugin controller
First of all sorry for my bad english and Im pretty new in these
First, sorry for my bad english, I'm French. Here the problem : I have
first of all... i'm italian, so i'm sorry for my bad english! so... this
First, sorry for my bad English, i'm a French Student. And i'm also a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.