• Resolved david6630

    (@david6630)


    Hi everyone, I deployed in my wordpress website a custom javascript application to design your own bike and order it. This application uses multiple images to build the rendering of the bike. The site used default permalinks and everything worked fine.
    After i installed nextgen gallery plugin that needs postname permalinks to work well.
    When i use postname permalinks my javascript application starts without problem however when i want to choose the color of the component of the bike my application give me the message “Error loading image”. Using chrome dev tools i understood the problem: postname permalinks rename the images url.
    My images are stored in “wordpress” folder of my server and postname permalinks rename the url in “mywebsite.com/post-name/url of my images” rather than “mywebsite.com/url of my images”.

    Could you help me please?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    How is your javascript getting permalinks? You could probably filter permalink output to rebuild urls to a certain folder as the default style. It may be easier to have javascript just strip out the post-name portion, assuming it’s always in the same position for the images in question. Or maybe just have javascript build it’s own urls based on user input and forget about permalinks.

    Thread Starter david6630

    (@david6630)

    function loadImage(container, image_url) {
    //	alert(container + ' ' + image_url);
        var img = new Image();
    	$(img).load(function () {
    		$(this).hide();
    		$(container).html(this);
    
    		$(this).queue(function () {
    			$('#loader').stop().fadeOut('fast');
    			$(this).dequeue();
    		});
    
    		$(this).fadeIn('fast');
    	}).error(function () {
    		alert('Error loading image');
    	}).attr('src', image_url); //---> .attr('src', "mywebsite.com"+image_url);
    }

    This is my own function to load image, the problem was in the last line where i add the attribute ‘src’ to my image. In my application i use relative url however “postname” permalinks change the base URL so i solved changhing to absolute url. Probably is not an elegant solution.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Postname permalinks change my application resource url’ is closed to new replies.